OAuthSwift(2.2.0) is being added in exisitng iOS OBJC project. The project was developed for iOS version 8 and earlier. For updating the project, we are not taking up full conversion of the project to swift. Decided to retain core ObjC modules, and develop all new features using Swift, for iOS 13.0. More importantly, the project also uses C++ libraries and other 3rd party libraries.
The project has 100+ implementation classes had each have 100s of lines of code. I understands from several guides and articles that there are lot of hiccups in OBJC > SWIFT conversion.
The existing AppDelegate.m has interoperability with several controllers, we are currently held with didFinishLaunchingWithOptions between AppDelegate.m and SceneDelgate.swift.
The actual issue:
we tried,
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let url = URLContexts.first?.url else {
return
}
if url.host == "oauth-callback" {
OAuthSwift.handle(url: url)
}
}
But, Scene mapping causing issues with UIWindow nil, unable to present the rootviewcontroller.
Optionally, I have tried, openURL in AppDelegate.m as below.
(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
if ([url.host isEqualToString:@"oauth-callback"]) {
[OAuthSwift handleWithUrl:url];
}
return YES;
}
The above seems to be accessing the OAuthToken. However, OAuthToken is getting lost somewhere. It would be guiding to know....
Whether our strategy to retain Objc feasible?
How do we solve SceneDelegate.swift and AppDelegate.m interoperability issues, with OAuth? Any reference to OBJC compatible OAuth2.0 Framework?
Can SFSafariController be used, instead to call OAuthSwift, access token?
Thanks in advance.