I've seen examples of how to resolve this error but I can't get it to work in my case.
Initializer for conditional binding must have Optional type, not 'Int'
Shouldn't employeeCount be optional since it is inferring the right side?
static func getEmployeeCount() -> Int {
if let employeeCount = UserDefaults.standard.integer(forKey: "employeeCount") {
return employeeCount as! Int
}
return 0
}