I am getting a error after converting Objective-C to Swift. Thanks
var gymdays = GymHours.orderedDays()
for i in 0..<gymdays?.count {
}
My Objective-C code:
NSArray *days = [GymHours orderedDays];
for (uint i = 0; i < days.count; i++) {
}
Int? is optional, so Xcode is telling you you are trying to use a value that may or may not be there.
You can use the following to avoid a crash if the value is nil:
for i in 0..<(gymdays?.count ?? 0) {
}