Controlling actor execution of mapped Obj-C calls

In the GoogleSignIn and Firebase frameworks, various methods are expected to be called from the main queue, as the methods are almost always triggered from buttons. For example

- (void)signInWithPresentingViewController:(UIViewController *)presentingViewController
                                completion:(nullable GIDSignInCompletion)completion

However, in Swift, these methods can be adapted into async / await automatically, providing a tempting call site: signIn(withPresenting:) async throws -> GIDSignInResult. However, this variant will lead to main queue warnings, as it ends up being called on the global executor instead.

Now, this framework hasn't yet adopted NS_SWIFT_UI_ACTOR, but apparently that wouldn't matter anyway due to a bug or design limitations. So the question is, is there anything else we can do with import Obj-C code to get it onto the proper actor, or are we stuck with using continuations to provide our own async method?

1 Like