Skip to content

Instantly share code, notes, and snippets.

@trupin
Last active September 24, 2018 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trupin/a32baff811bf955b02cba1d019a131cc to your computer and use it in GitHub Desktop.
Save trupin/a32baff811bf955b02cba1d019a131cc to your computer and use it in GitHub Desktop.
import UIKit
final class MovieViewController: UIViewController {
private let dependencies: MovieViewControllerDependencyResolver
// weaver: movie <= Movie
private lazy var overviewLabel: UILabel = {
let label = UILabel()
label.textColor = .white
label.numberOfLines = 0
label.font = .systemFont(ofSize: 15)
label.textAlignment = .natural
return label
}()
required init(injecting dependencies: MovieViewControllerDependencyResolver) {
self.dependencies = dependencies
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .black
edgesForExtendedLayout = []
view.addSubview(overviewLabel)
NSLayoutConstraint.activate([
overviewLabel.topAnchor.constraintEqualToSystemSpacingBelow(view.topAnchor, multiplier: 2),
overviewLabel.leadingAnchor.constraintEqualToSystemSpacingAfter(view.leadingAnchor, multiplier: 2),
view.trailingAnchor.constraintEqualToSystemSpacingAfter(overviewLabel.trailingAnchor, multiplier: 2),
view.bottomAnchor.constraintGreaterThanOrEqualToSystemSpacingBelow(overviewLabel.bottomAnchor, multiplier: 2)
])
title = dependencies.movie.title
self.overviewLabel.text = dependencies.movie.overview
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment