I am using Xcode 11. I deleted the all the SceneDelegate methods and setting up the rootViewController through AppDelegate. But it doesn't push the view controller to the next. What can be wrong ?
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow()
window?.rootViewController = ViewController()
return true
}
}
ViewController FILE
let plusPhotoButton: UIButton = {
let btn = UIButton(type: .system)
btn.setImage(UIImage(named: "plus_photo"), for: .normal)
btn.addTarget(self, action: #selector(source), for: .touchUpInside)
return btn
}()
@objc func source () {
let source = SourceViewController()
self.navigationController?.pushViewController(source, animated: true)
}