Your First Swift 4 & iOS 11 App - Part 42: | Ray Wenderlich

Great! Also it works on ios12 @raywenderlich hopefully at the end of my studies with your curriculum will become a coder by January. I really love technology from a kid, it’s time I leave the music industry to pursue my love for technology. :slight_smile:

Awesome! I’m glad to hear you’re enjoying the course, and I wish you all the best with your career switch! :]

1 Like

I had trouble with the web view, too.
I fixed it by using a WebKitView like Xcode was suggesting, instead of the WebView (now deprecated).
1- Drag the WebKitView onto your About Page
2- Declare the new IBoutlet in your AboutViewController like this:

@IBOutlet weak var webView: WKWebView!

3- Link the Outlet as seen in the video.
4- The compiler might complain about how you load the view, so replace this line:

webView.load(htmlData, mimeType: “text/html”, characterEncodingName: “UTF-8”, baseURL: baseURL)

5- Profit!

Everything in the tutorial works except for the following:

  • from the library, use WebKit View instead of Web View;
  • use this line:
    @IBOutlet weak var webView: WKWebView!
    instead of this one:
    @IBOutlet weak var webView: UIWebView!
  • add the following line, after import UIKit:
    import WebKit

Also keep in mind we have a new version of this course, fully updated for Swift 4.2, Xcode 10, and iOS 12 that fixes this issue and more:

Is the updated version available? By code does not work

I meant my code does not work. I followed the example in the tutorial:
if let htmlPath = Bundle.main.path(forResource: “BullsEye”, ofType: “html”) {let url = URL(fileURLWithPath: html) let request = URLRequest(url: url) webView.load(request) }

@mortlambert Do you still have issues?