@@ -221,30 +221,30 @@ To deep link, Branch must initialize a session to check if the user originated f
221221
222222###### Swift
223223``` swift
224- func application (application : UIApplication, didFinishLaunchingWithOptions launchOptions : [NSObject: AnyObject ]? ) -> Bool {
225- let branch: Branch = Branch.getInstance ()
226- branch.initSessionWithLaunchOptions (launchOptions, andRegisterDeepLinkHandler : { params, error in
227- // route the user based on what's in params
228- })
229- return true
230- }
231-
232- func application (application : UIApplication, openURL url : NSURL, sourceApplication : String ? , annotation : AnyObject ) -> Bool {
233- if (! Branch.getInstance ().handleDeepLink (url)) {
234- // do other deep link routing for the Facebook SDK, Pinterest SDK, etc
224+ func application (_ application : UIApplication, didFinishLaunchingWithOptions launchOptions : [UIApplicationLaunchOptionsKey: Any ]? ) -> Bool {
225+ let branch: Branch = Branch.getInstance ()
226+ branch.initSession (launchOptions : launchOptions, deepLinkHandler : { params, error in
227+ if error == nil {
228+ // route the user based on what's in params
235229 }
230+ }
231+ return true
232+ }
236233
234+ func application (_ application: UIApplication, open url: URL, sourceApplication : String ? , annotation : Any ) -> Bool {
235+ Branch.getInstance ().handleDeepLink (url)
236+
237237 return true
238238}
239239
240- func application (application : UIApplication, continueUserActivity userActivity : NSUserActivity, restorationHandler : ([ AnyObject ]? ) -> Void ) -> Bool {
240+ func application (_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler : @escaping ([ Any ]? ) -> Void ) -> Bool {
241241 // pass the url to the handle deep link call
242242 Branch.getInstance ().continueUserActivity (userActivity);
243243
244244 return true
245245}
246246
247- func application (application : UIApplication, didReceiveRemoteNotification launchOptions : [NSObject: AnyObject ] ? ) -> Void {
247+ func application (_ application: UIApplication, didReceiveRemoteNotification launchOptions: [AnyHashable : Any ] ) -> Void {
248248 Branch.getInstance ().handlePushNotification (launchOptions)
249249}
250250```
@@ -640,11 +640,11 @@ linkProperties.addControlParam("$ios_url", withValue: "http://example.com/ios")
640640```
641641
642642```swift
643- branchUniversalObject.getShortUrl (with : linkProperties, andCallback : { (url : String , error : Error ? ) in
643+ branchUniversalObject.getShortUrl (with : linkProperties) { (url, error) in
644644 if error == nil {
645645 NSLog (" got my Branch link to share: %@" , url)
646646 }
647- })
647+ }
648648```
649649
650650#### Link Properties Parameters
@@ -734,12 +734,11 @@ linkProperties.addControlParam("$ios_url", withValue: "http://example.com/ios")
734734```
735735
736736```swift
737- branchUniversalObject.showShareSheetWithLinkProperties (linkProperties,
738- andShareText : " Super amazing thing I want to share!" ,
739- fromViewController : self ,
740- completion : { () -> Void in
737+ branchUniversalObject.showShareSheet (with : linkProperties,
738+ andShareText : " Super amazing thing I want to share!" ,
739+ from : self ) { (activityType, completed) in
741740 NSLog (" done showing share sheet!" )
742- })
741+ }
743742```
744743
745744#### Show Share Sheet Parameters
@@ -818,7 +817,7 @@ Reward balances change randomly on the backend when certain actions are taken (d
818817###### Swift
819818
820819```swift
821- Branch.getInstance().loadRewardsWithCallback { (changed: Bool , error: NSError!) -> Void in
820+ Branch.getInstance ().loadRewards { (changed, error) in
822821 // changed boolean will indicate if the balance changed from what is currently in memory
823822
824823 // will return the balance of the current user's credits
@@ -873,8 +872,8 @@ This call will retrieve the entire history of credits and redemptions from the i
873872###### Swift
874873
875874```swift
876- Branch.getInstance().getCreditHistoryWithCallback { (history: [AnyObject]! , error: NSError!) -> Void in
877- if ( error == nil) {
875+ Branch.getInstance ().getCreditHistory { (creditHistory , error) in
876+ if error == nil {
878877 // process history
879878 }
880879}
0 commit comments