Your First Swift 4 & iOS 11 App - Images - Section 5

Good afternoon. I’m really enjoying the course and I’m making amazing progress. However, I cannot seem to find the link to download the images for section 5 - Making it look pretty. The only download I could find was the one containing the PDF of the slides.

Never mind. I sorted it.

1 Like

Glad you sorted it :slight_smile: please let us know if you need help with anything else :+1:

Hello. Actually, there is something else. I am using the UIWebView to display the BullsEye.html page. Now everything compiles and runs but the webpage doesn’t render in the UIWebView widget.

Code below:

@IBOutlet weak var webView: UIWebView!

@IBAction func close() {
    dismiss(animated: true, completion: nil)
}

override func viewDidLoad() {
    super.viewDidLoad()
    
    if let url = Bundle.main.url(forResource: "BullsEye", withExtension: "html") {
        if let htmlData = try? Data(contentsOf: url) {
            let baseURL = URL(fileURLWithPath: Bundle.main.bundlePath)
            webView.load(htmlData, mimeType: "text/html", textEncodingName: "UTF-8", baseURL: baseURL)
        }
    }

} 

Any thoughts?

Hmm I’m not too sure but off the top of my head, I think you can pass nil here for baseURL.

If that was wrong, try setting the web views delegate and listen for the error callback for more info as to why things won’t load :slightly_smiling_face:

This topic was automatically closed after 166 days. New replies are no longer allowed.