How to use SafariViewController on all App URLs

0

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

However, each ViewController displays many URLs that are automatically recognized within TextViews and it would be very stressful to use a SafariVC process for each URL.

So how do I make the URLs of TextView open SafariViewController ?

    
asked by anonymous 25.05.2017 / 00:32

1 answer

0

I recommend using CSafariWebKit

In your file

import CSafariWebKit

Declare

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

This function fires when a cell is selected. And then get your url in the cell of that 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.

    
14.05.2018 / 02:16