- GCD : 디스패치 큐
- Operation : 오퍼레이션 큐
//MARK: - Main Queue
DispatchQueue.main
DispatchQueue.main.sync {...} // Error 사용불가
DispatchQueue.main.async {...} // 비동기적으로 Main Thread(Thread 1)으로 보냄
DisoatchQueue.main.asyncAfter(now() + 2) {...} // 지금으로 부터 2초 후에 비동기적으로 Main thread에 호출
// MARK: UI업데이트,애니메이션 등에 사용 (즉시)
DispatchQueue.global(qos: .userInteractive)
// MARK: 비동기적으로 처리된 작업 : 앱 내에서 pdf 파일을 여는 작업 (몇 초)
DispatchQueue.global(qos: .userInitiated)
// MARK: 디폴트
Dispatchqueue.global()
// MARK: Networking, Progress Indicator와 함께 길게 실행하는 작업 (몇초에서 몇분)
DispatchQueue.global(qos: .utility)
//MARK: 시간이 안 중요한 작업, 데이터 미리가져오기, 데이터 베이스 유지 (몇분 이상)
DispatchQueue.global(qos: .background)
//MARK: legacy API
DispatchQueue.global(qos: .unspecified)
let customQueue = DispatchQueue(label:"SerialQueue")
let customConcurrentQueue = DispatchQueue(label: "ConcurrentQueue", attributes: .concurrent)
인프런 - iOS Concurrency(동시성) 프로그래밍, 동기 비동기 처리 그리고 GCD/Operation - 디스패치큐와 오퍼레이션큐의 이해