I'm using an array that returns whether any of my nested buttons are selected.
To make it easier on me, I made this internal function.
Everything gets really really slow.
I took out the helper function and build times went up to pretty much instant.
Not sure why the type inference isn't working here? (If that is the problem)
I have read this Why is swift compile time so slow?, but I don't yet know why these specific lines are stalling.
func areAnyAMPMButtonsSelected() -> [Bool] {
func nilToBool(optional: AppointmentDatePickerAMPMButton?) -> Bool {
return (optional != nil) ? optional!.selected : false
}
return [
nilToBool(self.sundayAMButton),
nilToBool(self.mondayAMButton),
nilToBool(self.tuesdayAMButton),
nilToBool(self.wednesdayAMButton),
nilToBool(self.thursdayAMButton),
nilToBool(self.fridayAMButton),
nilToBool(self.saturdayAMButton),
nilToBool(self.sundayPMButton),
nilToBool(self.mondayPMButton),
nilToBool(self.tuesdayPMButton),
nilToBool(self.wednesdayPMButton),
nilToBool(self.thursdayPMButton),
nilToBool(self.fridayPMButton),
nilToBool(self.saturdayPMButton)
]
Compiler Stalling here
1. While type-checking 'getValidTimesArray' at /Users/gustavo/Projects/vm/yips-ios/YIPS-iOS/AppointmentDatePickerView.swift:104:5
2. While type-checking expression at [/Users/gustavo/Projects/vm/yips-ios/YIPS-iOS/AppointmentDatePickerView.swift:110:16 - line:126:9] RangeText="[ nilToBool(self.sundayAMButton), nilToBool(self.mondayAMButton), nilToBool(self.tuesdayAMButton), nilToBool(self.wednesdayAMButton), nilToBool(self.thursdayAMButton), nilToBool(self.fridayAMButton), nilToBool(self.saturdayAMButton),
nilToBool(self.sundayPMButton),
nilToBool(self.mondayPMButton),
nilToBool(self.tuesdayPMButton),
nilToBool(self.wednesdayPMButton),
nilToBool(self.thursdayPMButton),
nilToBool(self.fridayPMButton),
nilToBool(self.saturdayPMButton)
]"