I am using the new Swift 5.5 features to create an async function:
@MainActor
@objc func updateStatus() async {
/// do async stuff...
}
But when I try to call this method from Objective-C code, it doesn't show up in autocomplete and gives a build error if I try to build it:
if (@available(iOS 15.0, *)) {
CJSubscriptionStatusCheck *backgroundStatusCheck = [[CJSubscriptionStatusCheck alloc] init];
[backgroundStatusCheck updateStatus]; // No visible @interface for 'CJStatusCheck' declares the selector 'updateStatus'
}
My other swift code works fine with Objective-C so the setup is fine, but I'm not sure how the 'async' code can be used (if at all) with Objective-C. I can't find an answer to this with my research.
Thanks.
updateStatusCompletionHandler:
or something similar. – Histone