Skip to content

Instantly share code, notes, and snippets.

@scott-lydon
Created May 4, 2021 21:00
Show Gist options
  • Save scott-lydon/ba86e6c73fe06ff0aea54aceba50d74c to your computer and use it in GitHub Desktop.
Save scott-lydon/ba86e6c73fe06ff0aea54aceba50d74c to your computer and use it in GitHub Desktop.
Functional binding
struct CreateAccountViewModel {
var image: Image = Image("IntroImage")
var accentText: String = "Choose Account type"
var choosePathVM: ChoosePathViewModel = ChoosePathViewModel(index: 0, explanations: [.employee, .business])
var buttonImage: Image = Image(systemName: .rightArrowLine)
var spacerHeight: CGFloat = 40
var currentHeader: HeaderBody {
get {
choosePathVM.current
}
set {}
}
var employeeDestination: Bool {
get {
choosePathVM.current.header == HeaderBody.employee.header
}
set {}
}
var formModel: SignupFormViewModel {
get {
employeeDestination ? .employee : .business
}
set {}
}
var authViewModel: AuthViewModel {
get {
employeeDestination ? .employeeForm : .businessForm
}
set {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment