When creating iOS apps we find the need to have some buttons or UIControls opening a URL link.This can be easily done by calling the open(_:options:completionHandler:) method of UIApplication. With the addition of the SFSafariViewController in iOS 9, this opened new possibilities to show links without the user leaving the app.While the UIApplication open(_:options:completionHandler:) can be called from anywhere in your code, presenting a SFSafariViewController can happen only from a UIViewController.A real-world use case that leads to this solutionI was recently working on an application that parsed and builds interactive documents from a JSON object. Among the multiple objects that constitute an interactive document, there is a simple link object. If the user taps the link, we present the content in a SFSafariViewController (SafariVC) without leaving the app.The app hierarchy looked similar to the following diagram:The app hierarchy when viewing a documentAt the root we have a navigation controller and several embeds after we can see the link.
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.
Stay tuned to my blog, twitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.
mobile,swift,ios,ios-app-development,mobile-app-development
Stay tuned to my blog, twitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.
This article is related to
mobile,swift,ios,ios-app-development,mobile-app-development
0 Comments