WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

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() {
        // Do any additional setup after loading the view.
        let url = URL(string: "https://www.hackingwithswift.com")!
        webView.load(URLRequest(url: url))
        webView.allowsBackForwardNavigationGestures = true


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

Xcode simulator swiping


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



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

simulator: show device bezels


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



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.


wow thanks! it worked!


Hacking with Swift is sponsored by Emerge

SPONSORED Optimize your app’s startup time, binary size, and overall performance using Emerge’s advanced app optimization and monitoring tools. Reliably measure app size, speed up your app's startup time with Emerge's Launch Booster, and much more. Emerge is actively used by many of the top mobile development teams in the world.

Find out more

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

Reply to this topic…

You need to create an account or log in to reply.

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.