I'm making login flow right now.
There is two view controllers for email input and password input.
After validating email account, password input view controller pops up.
The email VC and password VC is very similar but slightly different.
just like "Enthr email" & "Enter password" (UILabel text)
I think that making custom view and reusing it is efficient.
But the two view controllers need different value(email, password string).
How can I pass different value to same custom view?
Or how can I reuse view for similar views programmatically?
For UIKit You can create custom textField component that takes inputType and specific customization related to that.
enum InputType {
case email
case password
}
class InputViewController: UIViewController {
let customTextField: CustomTextField!
var inputType: InputType!
convenience init(inputType: InputType) {
self.init()
self.inputType = inputType
}
override func viewDidLoad() {
super.viewDidLoad()
customTextField = CustomTextField(inputType: self.inputType)
}
}