Skip to content

Commit 82f2909

Browse files
committed
Merge pull request #52 from usebutton/wes/mutable_deeplink_example
Add mutable deep link example and AppLinks mention to the readme
2 parents 1fc3c96 + 98da165 commit 82f2909

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,17 @@ router[@"scheme-one://timeline"] = ^{ … }
122122
router[@"scheme-two://timeline"] = ^{ … }
123123
```
124124
125+
## AppLinks Support
126+
127+
Does you app support AppLinks? You can easily handle incoming AppLinks by importing the AppLinks category `DPLDeepLink+AppLinks`. The AppLinks category provides convenience accessors to all AppLinks 1.0 properties.
128+
129+
```objc
130+
router[@"/timeline"] = ^(DPLDeepLink *link) {
131+
NSURL *referrerURL = link.referralURL;
132+
NSString *someValue = link.extras[@"some-key"];
133+
}
134+
```
135+
125136
## Running the Demo
126137

127138
To run the example project, run `pod try DeepLinkSDK` in your terminal. You can also clone the repo, and run `pod install` from the project root. If you don't have CocoaPods, begin by [follow this guide](http://guides.cocoapods.org/using/getting-started.html).
@@ -130,6 +141,48 @@ There are two demo apps, `SenderDemo`, and `ReceiverDemo`. `ReceiverDemo` has so
130141

131142
Run the`SenderDemo` build scheme first, then stop the simulator and switch the build scheme to `ReceiverDemo` and run again. Now you can switch back to the `SenderDemo` app in the simulator and tap on one of the actions.
132143

144+
145+
## Creating Deep Links
146+
147+
You can also create deep links with `DPLMutableDeepLink`. Between two `DeepLinkKit` integrated apps, you can pass complex objects via deep link from one app to another app and easily get that object back on the other end.
148+
149+
In the first app:
150+
151+
```objc
152+
153+
NSMutableDeepLink *link = [[NSMutableDeepLink alloc] initWithString:@"app-two://categories"];
154+
link[@"brew-types"] = @[@"Ale", @"Lager", @"Stout", @"Wheat"]
155+
link[@"beers"] = @{
156+
@"ales": @[
157+
@{
158+
@"name": @"Southern Tier Pumking Ale",
159+
@"price": @799
160+
},
161+
@{
162+
@"name": @"Sierra Nevada Celebration Ale",
163+
@"price": @799
164+
}
165+
],
166+
@"lagers": @[
167+
...
168+
],
169+
...
170+
}
171+
172+
[[UIApplication sharedApplication] openURL:link.URL];
173+
174+
```
175+
176+
In the second app:
177+
178+
```objc
179+
router[@"categories"] = ^(DPLDeepLink *link) {
180+
NSArray *brewTypes = link[@"brew-types"];
181+
NSDictionary *beers = link[@"beers"];
182+
}
183+
```
184+
185+
133186
## Authors
134187

135188
[Wes Smith](http://twitter.com/w5mith)<br />

0 commit comments

Comments
 (0)