Snippets Collections
let now = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "LLLL"
let nameOfMonth = dateFormatter.string(from: now)
    func createBackButton() {
        let image = UIImage(named: "left-arrow") as UIImage?
        let button = UIButton(type: UIButton.ButtonType.custom) as UIButton
        let screenSize: CGRect = UIScreen.main.bounds
            let screenWidth = screenSize.width
            let screenHeight = screenSize.height
        
        button.frame = CGRect(x: screenWidth * 0.05, y: screenHeight * 0.05, width: screenWidth * 0.05, height: screenWidth * 0.03) // (X, Y, Height, Width)
        button.setImage(image, for: .normal)
        button.addTarget(self, action: #selector(customGoBack(sender:)), for: UIControl.Event.touchUpInside)
            self.view.addSubview(button)
    }
    
    @objc func customGoBack(sender: UIButton) {
        if self.webView.canGoBack {
            print("Can go back")
            self.webView.goBack()
            self.webView.reload()
        } else {
            print("Can't go back")
        }
    }

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension