To show a website in Swift, you can use either UIWebView
or WKWebView
. Here's an example of how to use UIWebView
:
main.swift351 chars16 lines
And here's an example of how to use WKWebView
:
main.swift358 chars17 lines
Note that WKWebView
requires import WebKit
to be added at the top of the file, and it's only available on iOS 8.0 and later.
gistlibby LogSnag