Browse between screens - Swift IOS

607 views ios
6

I have a question in navigation between screen in ios because I am new in this part, in android there is the "intent" that makes it easy to navigate between but in which function should I use to navigate between the screens programmatically, example I have the seguiten if:

class ViewController: UIViewController, WKNavigationDelegate{

@IBOutlet weak var webView: WKWebView!
var reachability:Reachability?
override func viewDidLoad() {
    super.viewDidLoad()
    webView.navigationDelegate = self

    self.reachability = Reachability.init()

    if ((self.reachability!.connection) != .none)
    {
        let url = URL(string: "https://www.sitemercado.com.br/frade/")
        let request = URLRequest(url: url!)
        webView.load(request)
        print ("Conectado")

    } else {

    }
}

And the following screens: imagem

I need it when it returns "else" the application goes to the offline screen, In android I use the "intent" but and in IOS?

answered question

1 Answer

5

You can try , give offline VC an identifier in IB and load it like this

let offline = storyBoard?.instantiateViewController(withIdentifier: "offline") as! OfflineVC
self.navigationController?.pushViewController(offline,animated:true)

posted this

Have an answer?

JD

Please login first before posting an answer.