Search code examples
iosswiftinappbrowserrss-reader

iOS in-App browser


Hey so I am building an iOS RSS Reader News app. Some long RSS articles end with a "Read more" link. After clicking "Read more", Safari opens up. I want it to - instead of having Safari open that link - open it inside the app.

Note: I need this to function permamently with every link in the app and without me having to manually change what links will be opened inside the app.


Solution

  • Create a WebViewController, just a regular ViewController with a webView with the size of the screen. So then you just

            let webViewController = WebViewController()
            webViewController.title = yourRSSItem.title
            webViewController.request = NSURLRequest(URL: NSURL(string: yourRSSItem.url)!)
            self.navigationController?.pushViewController(webViewController, animated: true) //you can present it as well