You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-41Lines changed: 13 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -288,50 +288,22 @@ instruction). Thus, implement the following method from `UIApplicationDelegate`
288
288
289
289
#### Integration of the library with a Swift iOS project
290
290
291
-
Until a better solution is available, we must use `react-native-app-auth` as a Static Library. This is due to the fact that the library is calling `AppDelegate.swift`.
292
-
293
-
1. Unlink `react-native-app-auth` from your projects `Libraries/`.
294
-
295
-
2. Manually copy the `RNAppAuth.h` and `RNAppAuth.m` files from the library folder in your `node_modules/` into your project folder.
296
-
297
-
3. In `RNAppAuth.m` add a new import:
298
-
```Objective-C
299
-
#import"<YouProjectName>-Swift.h"
300
-
```
301
-
302
-
4. In your project's `AppDelegate.swift`, expose your function to `Objective-C` by annotating the AppDelegate with:
303
-
```Swift
304
-
@objc(AppDelegate)
305
-
```
306
-
307
-
5. Add the following code just after the class declaration:
308
-
```Swift
309
-
var currentAuthorizationFlow: OIDAuthorizationFlowSession?
310
-
```
311
-
312
-
6. At the bottom of your class add the following code:
313
-
314
-
```Swift
315
-
func application(
291
+
The approach mentioned above should also be possible to employ with Swift. In this case one shoule have to import `RNAppAuth`
292
+
and make `AppDelegate` conform to `RNAppAuthAuthorizationFlowManager`. `AppDelegate` should look something like this:
if currentAuthorizationFlow!.resumeAuthorizationFlow(with: url){
321
-
currentAuthorizationFlow = nil
322
-
return true
323
-
}
324
-
325
-
return false;
326
-
}
327
-
```
328
-
This is a translation of the following `Objective-C` code provided [above](#add-a-current-authorization-session)
329
-
330
-
**Warning:**
331
-
332
-
You may need to perform Step 4 and compile your project so that the hidden bridging header file is created. If this file is not created and you follow the rest of the steps then you may fall into a chicken before the egg problem where the project is failing to build because of the missing header file and the header file won't be created because the build is failing.
0 commit comments