Skip to content

Instantly share code, notes, and snippets.

@mbuchetics
Last active February 19, 2021 09:36
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 mbuchetics/047c078c0a3ebebea7c7e1bb7b75744e to your computer and use it in GitHub Desktop.
Save mbuchetics/047c078c0a3ebebea7c7e1bb7b75744e to your computer and use it in GitHub Desktop.
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