Created
July 2, 2019 02:07
-
-
Save ufo22940268/2949fdf59c9860292f263ebb1e8036d7 to your computer and use it in GitHub Desktop.
Dismiss multi view controllers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
import AVKit | |
import PlaygroundSupport | |
class NCB: UINavigationController { | |
override func viewDidLoad() { | |
} | |
} | |
class VCC: UIViewController { | |
override func viewDidLoad() { | |
view.backgroundColor = .orange | |
DispatchQueue.main.asyncAfter(deadline: .now() + 3) { | |
self.navigationController?.dismiss(animated: true, completion: nil) | |
} | |
} | |
} | |
class VCB: UIViewController { | |
override func viewDidLoad() { | |
let vcc = VCC() | |
view.backgroundColor = .green | |
DispatchQueue.main.asyncAfter(deadline: .now() + 3) { | |
self.navigationController?.pushViewController(vcc, animated: true) | |
} | |
} | |
} | |
class VCA: UIViewController { | |
override func viewDidLoad() { | |
view.backgroundColor = .yellow | |
let vcb = VCB() | |
let ncb = NCB(rootViewController: vcb) | |
DispatchQueue.main.asyncAfter(deadline: .now() + 3) { | |
self.present(ncb, animated: true, completion: nil) | |
} | |
} | |
} | |
let vca = VCA() | |
PlaygroundPage.current.liveView = vca | |
PlaygroundPage.current.needsIndefiniteExecution = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment