ios - The count in my For loop is not incrementing -
when running code, getting number of 1's printing console rather 1,2,3,4,5....
some why happening great, i'm having trouble figuring out.
the idea loop through calendar names until finding 'travel' calendar.
func checkcalendarexists(){ var eventcalendars = store.calendarsforentitytype(ekentitytypeevent) [ekcalendar] in eventcalendars { var count = 0 var calendarcount = eventcalendars.count if i.title != "travel" && count != calendarcount { ++count println(count) } else if i.title == "travel" { // } else { amethod() } } }
your count variable not being incremented because declared inside loop , initialized value 0 @ beginning of each iteration. code work expected have move var count = 0
outside loop.
Comments
Post a Comment