Skip to content

Commit 24cc3f2

Browse files
committed
docs: update iOS deep linking Swift snippets
1 parent c77b408 commit 24cc3f2

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

versioned_docs/version-8.x/deep-linking.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,19 @@ See [Expo's documentation on Android App Links](https://docs.expo.dev/linking/an
128128

129129
Let's configure the native iOS app to open based on the `example://` URI scheme.
130130

131-
You'll need to add the `LinkingIOS` folder into your header search paths as described [here](https://reactnative.dev/docs/linking-libraries-ios#step-3). Then you'll need to add the following lines to your or `AppDelegate.swift` or `AppDelegate.mm` file:
131+
You'll need to add the `LinkingIOS` folder into your header search paths as described [here](https://reactnative.dev/docs/linking-libraries-ios#step-3). Then you'll need to add the following lines to your `AppDelegate.swift` or `AppDelegate.mm` file:
132132

133133
<Tabs groupId="ios-lang">
134134
<TabItem value='swift' label='Swift' default>
135135

136136
```swift
137-
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
137+
import React
138+
139+
override func application(
140+
_ app: UIApplication,
141+
open url: URL,
142+
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
143+
) -> Bool {
138144
return RCTLinkingManager.application(app, open: url, options: options)
139145
}
140146
```
@@ -162,16 +168,17 @@ If your app is using [Universal Links](https://developer.apple.com/ios/universal
162168
<TabItem value='swift' label='Swift' default>
163169

164170
```swift
165-
func application(
171+
override func application(
166172
_ application: UIApplication,
167173
continue userActivity: NSUserActivity,
168-
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
169-
return RCTLinkingManager.application(
170-
application,
171-
continue: userActivity,
172-
restorationHandler: restorationHandler
173-
)
174-
}
174+
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
175+
) -> Bool {
176+
return RCTLinkingManager.application(
177+
application,
178+
continue: userActivity,
179+
restorationHandler: restorationHandler
180+
)
181+
}
175182
```
176183

177184
</TabItem>

0 commit comments

Comments
 (0)