Skip to content

Instantly share code, notes, and snippets.

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