Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.