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      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

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.