iOS/Objective-C

[Objective-C] GCD / Paul Hudson의 Objective-C cheat sheet

TDCIAN 2023. 4. 12. 09:39

사진에 원본 링크 걸어놨습니다!

 

5. GCD

Running code on different threads

 

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSLog(@"Running in the background...");
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Running back on the main thread");
});
});
/*
DispatchQueue.global().async {
print("Running in the background...")
DispatchQueue.main.async {
print("Running on the main thread")
}
}
*/
view raw objc_gcd.m hosted with ❤ by GitHub