Youngminah / TIL

🌱 iOS 필수 숙지 개념 레포
282 stars 20 forks source link

GCD QoS #126

Closed Youngminah closed 2 years ago

Youngminah commented 2 years ago

읽기전에

GCD QoS (Quality of Service)

image

예제

@IBAction func globalQos(_ sender: UIButton) { 

    DispatchQueue.global(qos: .background).async {
        for i in 1...50 {
            print(i, terminator: " ")
        }
        print("\nBackground 완료")
    }

    DispatchQueue.global(qos: .userInteractive).async {
        for i in 51...100 {
            print(i, terminator: " ")
        }
        print("\nUserInteractive 완료")
    }

    DispatchQueue.global(qos: .utility).async {
        for i in 101...150 {
            print(i, terminator: " ")
        }
        print("\nUtility 완료")
    }
}

출력결과

image



참고자료