Last active
April 3, 2018 21:27
-
-
Save raonivaladares/2728b7b1db7f35a6013635f712b90a58 to your computer and use it in GitHub Desktop.
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
import UIKit | |
class FirstViewController: UIViewController { | |
private let topicLabel: UILabel = { | |
let label = UILabel() | |
label.text = "Topic" | |
label.textAlignment = .center | |
label.translatesAutoresizingMaskIntoConstraints = false | |
return label | |
}() | |
// MARK: - View lify-cicle | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
buildUI() | |
} | |
// MARK: - Private methods | |
private func buildUI() { | |
view.backgroundColor = .white | |
view.addSubview(topicLabel) | |
NSLayoutConstraint.activate([ | |
topicLabel.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), | |
topicLabel.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), | |
topicLabel.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor), | |
]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment