I need to declare a variable of type OIDAuthorizationService
, from the AppAuth
(https://github.com/openid/AppAuth-iOS) library, in Swift
while translating the following Objective-C
to Swift
to use an Objective-C
library in a project.
Pre-translated objective-c
.h
+ @protocol OIDAuthorizationFlowSession;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
+ @property(nonatomic, strong, nullable)
id<OIDAuthorizationFlowSession> currentAuthorizationFlow;
@property (nonatomic, strong) UIWindow *window;
@end
.m
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary<NSString *, id> *)options {
if ([_currentAuthorizationFlow resumeAuthorizationFlowWithURL:url]) {
_currentAuthorizationFlow = nil;
return YES;
}
return NO;
}
So far I have the following translation:
var currentAuthorizationFlow: OIDAuthorizationFlowSession?
...
func application(_ application: UIApplication, openURL: NSURL,
didFinishLaunchingWithOptions launchOptions:
[UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if currentAuthorizationFlow!.resumeAuthorizationFlow(with: openURL as URL) {
return true
}
return false
}
Is this code correct?
Error is: Use of undeclared type: 'OIDAuthorizationFlowSession'
, as espected, how do I do this?
Much appreciated