Last active
February 19, 2021 09:36
-
-
Save mbuchetics/047c078c0a3ebebea7c7e1bb7b75744e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Foundation | |
import UIKit | |
import DataSource | |
class TemplateViewController: UIViewController { | |
// MARK: Interface | |
var onSubmit: ((String) -> Void)! // ! für required closures, ? für wirklich optionale | |
var onCancel: (() -> Void)! | |
static func create(title: String, viewModel: TemplateViewModel) -> TemplateViewController { | |
let viewController = TemplateViewController() | |
viewController.viewModel = viewModel | |
return viewController | |
} | |
// MARK: Views | |
@IBOutlet private var titleLabel: UILabel! | |
@IBOutlet private var profileImageView: UIImageView! | |
private lazy var headerView = UIView().with { | |
$0.backgroundColor = .red | |
} | |
// MARK: Private | |
private var viewModel: TemplateViewModel! | |
// computed properties usw. | |
// MARK: Lifecycle | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
setupViews() | |
} | |
override func viewDidLayoutSubviews() { | |
super.viewDidLayoutSubviews() | |
} | |
private func setupViews() { | |
view.addSubview(headerView) | |
// autolayout constraints | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment