UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: project 4: swipe left to go back not working

Forums > 100 Days of Swift

Hi, the swipe left to go back is not working in the simulator app. my code is exactly the same as in the tutorial.

import UIKit
import WebKit

class ViewController: UIViewController, WKNavigationDelegate {
    var webView: WKWebView!

    override func loadView() {
        webView = WKWebView() //create instance of WKWebView class
        webView.navigationDelegate = self
        view = webView //make webView the view of our view controller
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        let url = URL(string: "https://www.hackingwithswift.com")!
        webView.load(URLRequest(url: url))
        webView.allowsBackForwardNavigationGestures = true
    }
}

3      

Make sure you are swiping from the right spot. You have to start just off the screen.

Xcode simulator swiping

4      

when i try swiping just off the screen, the screen resizes. attached screenshot.

https://drive.google.com/file/d/17Hs5lLB4Imp24HVudaQRNkQcMfbhrb5f/view?usp=sharing

3      

Make sure you have Show Device Bezels turned on in the simulator:

simulator: show device bezels

3      

the "show device bezels" is already enabled under editor -> canvas. after running the simulator, the device bezel is still not visible.

https://drive.google.com/file/d/1GlnwsgQ3mWRrCzcvJ0zZAut4YwIeguOJ/view?usp=sharing

3      

That's in Xcode, not in the Simulator. Notice that the menu in your screenshot is completely different from the one in my screenshot. You need to enable it in the Simulator.

4      

wow thanks! it worked!

3      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.