Sunday, December 4, 2022
HomeiOS Developmentios - Understanding GlobalActor, is it assured it will not execute on...

ios – Understanding GlobalActor, is it assured it will not execute on Principal Thread


I am studying usages of async-await and together with that learn in regards to the World Actors. I do know MainActor is GlobalActor, and if we annotate a technique with @mainActor, the strategy will probably be executed on Principal Thread. Just like that if we create a customized GlobalActor, do we all know which thread it’s going to use to carry out.

@globalActor actor CustomGlobalActor {
     static let shared = CustomGlobalActor()
 }

@CustomGlobalActor func performTask() async -> Output {
    .....
}

Additionally, extra questions:

  1. Can we use it interchangeably to carry out time consuming duties in background thread?
  2. Is it linked to World Queues in any method?
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments