Last active
September 12, 2019 18:00
-
-
Save mendesbarreto/b8526c48dda9ab42771e8e4b0f211c46 to your computer and use it in GitHub Desktop.
Example of how to create a view controller with nib
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
// | |
// HomeViewControllerTests.swift | |
// DitMoi | |
// | |
// Created by Douglas Barreto on 10/01/18. | |
// Copyright © 2018 Douglas Mendes. All rights reserved. | |
// | |
import UIKit | |
final class HomeViewController: UIViewController { | |
@IBOutlet var label: UILabel! | |
var hello: String! | |
private init() { | |
super.init(nibName: String.init(describing: type(of: self)), bundle: nil) | |
} | |
convenience init(hello: String){ | |
self.init() | |
self.hello = hello | |
} | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
} | |
override func viewDidLoad() { | |
label.text = hello | |
UIView.animate(withDuration: 5, animations: { | |
}) { _ in | |
self.navigationController?.pushViewController(HomeViewController(hello: "Test with xib"), animated: true) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment