Last active
May 29, 2020 00:46
-
-
Save rlnucci/b433889be7fde79a06ddd43af6af87d4 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
| protocol NextCustomViewProtocol where Self: UIView {} | |
| final class DefaultNextCustomView: UIView, NextCustomViewProtocol { | |
| override init(frame: CGRect = .zero) { | |
| super.init(frame: frame) | |
| // setup here | |
| } | |
| required init?(coder: NSCoder) { | |
| fatalError() | |
| } | |
| // setup methods goes here... | |
| } | |
| final class NextViewController: UIViewController { | |
| private let nextCustomView: NextCustomViewProtocol | |
| private let data: String | |
| init(data: String, nextCustomView: NextCustomViewProtocol = DefaultNextCustomView()) { | |
| self.nextCustomView = nextCustomView | |
| self.data = data | |
| super.init(nibName: nil, bundle: nil) | |
| } | |
| required init?(coder aDecoder: NSCoder) { | |
| fatalError() | |
| } | |
| override func loadView() { | |
| view = nextCustomView | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment