How to use Safariviewcontroller on all App Urls

Asked

Viewed 30 times

-1

I have an App that presents itself initially with a TableViewController where each cell leads to a ViewController simple.

But each Viewcontroller presents many Urls that are automatically recognized within Textviews and it would be very stressful to use a Safarivc process for each URL.

ViewController

So, how do I do for the Urls of TextView open a SafariViewController?

1 answer

1


I recommend using the Csafariwebkit

In your file

import CSafariWebKit

Declare

optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

This function is triggered when a cell is selected. And then take your url in the cell of this Indexpath and call the Safariviewcontroller as below.

let vc = SafariViewController(url: url, barTintColor: nil, tintColor: nil)
vc.presentSafari(fromViewController: self, whenDidFinish: nil)

Use the colors of your app for a better experience.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.