zjfjack / JZCalendarWeekView

Calendar Week & Day View in iOS Swift
MIT License
454 stars 121 forks source link

Repeating Events #27

Closed porollto closed 5 years ago

porollto commented 5 years ago

Hi! Thank you for sharing your work! I wonder if it is possible to create repeating Events (such as every Monday etc.)? Do you have any suggestions how this could be achieved?

Cheers!

zjfjack commented 5 years ago

For those repeating events, I think you can only generate dates and add them into the events list through the JZWeekViewHelper.getIntraEventsByDate.

Also, for the efficiency issue you shouldn't generate too many events into the events list. Maybe you can load few months and refresh them with self.forceReload(reloadEvents: allEvents) after date changing to some boundary.

Thanks

porollto commented 5 years ago

Thanks for your hint! I've managed to create repeating Events by implementung initDateDidChange(_ weekView: JZBaseWeekView, initDate: Date). Given the fact, that initDate is always the visible Date -1, I calculate the "next occurence" of the event by adding 7 days.