Our iOS notes application is now largely feature-complete. It’s fully operational, but could do with a few more finishing touches to add some polish. In this chapter, we’ll add support for opening links in the provided web browser view controller, overall app settings, undo, and image filters.
Links in the text are currently tappable, but this functionality is not ideal, for two reasons:
It’s available only when the text view is not editable.
Tapping links launches Safari, taking users out of the app. This is probably something they don’t want.
To fix the first problem, we’ll add support for moving between an “editing” mode and a “viewing” mode for the
DocumentViewController. To fix the second, we’ll override the existing behavior for opening links, and instead open them in the
There are three ways in which an app can display web content: creating a custom mini-browser by using
UIWebView, pushing the user out of the app by opening Safari using
openURL, or using
SFSafariViewController to display a compact version of Safari within the app.
UIWebView are outside the scope of this book, as these days they’re only necessary if you’re doing something complex with web views, or you’re making your own web browser for iOS (like Chrome, Firefox, Mercury Browser, or similar). In the past, most apps implemented their own custom mini-browser using either