You asked if I had any other suggestions… well, JTAppleCalendar is already awesome, and it works great, but here are a few thoughts, mostly just some tiny details that I think could be improved.
Take these methods, for instance:
func configureCalendar(calendar: JTAppleCalendarView)
func calendar(calendar : JTAppleCalendarView, isAboutToResetCell cell: JTAppleDayCellView){}
Why is the colon next to calendar
in the first case but separated with a space in the second? There are many other similar inconsistencies. I suggest you give SwiftLint a try. I can set it up at the demo project if you're interested.
Also, why the name isAboutToResetCell
instead of the standard willResetCell
? Apple has some guidelines about that here.
And speaking of naming conventions, I didn't really take a deep look at the changes in swift 3 yet, but I think according to the new convention (check the second item, "omit needless words") that method should read isAboutToReset cell: JTAppleDayCellView
instead of isAboutToResetCell cell: JTAppleDayCellView
. There are many other examples like that, and since swift 3 already makes a lot of those breaking changes it's a great excuse to make them here too I think.
Also, since you already follow the way table views work, why use that calendarView.registerCellViewXib(fileName: "CellView")
property instead of a delegate method like cellForDayAtDate
(like you have cellForRowAtIndexPath
for table views)? Then the user would be able to configure the cell right in the view controller where it will be displayed, instead of cramming the code in the cell class. (How many lines do your UITableViewCell
classes have? A lot less than your JTAppleDayCellView
classes, I bet.) Also that would allow the user to add the cell view straight to the view controller the calendar view is in (like it is with UITableView
s), instead of having to add a dedicated xib
. And the cell view class would be a lot easier to repurpose.
Lastly, this may by a little more tricky and it's not essential, but since you seem to be making some big changes already, here's another suggestion. I think it would be better if the calendar didn't have those startDate
and endDate
limits. It would just have an initial date that could default to today, and then the UICollectionView
would be created with 3 months, the current month, the month before and the month after. When the user scrolled to the next month, one more month would be added after that one, and so on. And if the user wanted he could set a property like calendarView.maxDate
.
As I said, these are all just suggestions, feel free to ignore them if you prefer. JTAppleCalendar is really great already. :)
This is not a bug. Works as expected.