-
-
Save susieyy/3a3f1a06923994c1e32845a5e87e8a44 to your computer and use it in GitHub Desktop.
#swtws
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol FBAppPresentable {} | |
extension FBAppPresentable where Self: UIViewController { | |
func openFacebookUrl(url: NSURL) { | |
guard let userId = url.lastPathComponent where Global.fbInstalled else { | |
presentWebViewController(of: url); return | |
} | |
guard let encodedUrl = NSURL.encoded(of: "fb://profile/\(userId)") else { | |
presentWebViewController(of: url); return | |
} | |
UIApplication.sharedApplication().openURL(encodedUrl) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment