airbnb / HorizonCalendar

A declarative, performant, iOS calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-featured calendar apps.
Apache License 2.0
2.8k stars 234 forks source link

Update `CalendarViewRepresentable` methods to have the same signature as corresponding `CalendarViewContent` methods #271

Closed calda closed 1 year ago

calda commented 1 year ago

Details

Inside Airbnb we use the follow protocol to abstract CalendarViewRepresentable and CalendarViewContent behind a single type:

public protocol CalendarContentConfigurable {
  func monthHeaderItemProvider(
    _ monthHeaderItemProvider: @escaping (_ month: Month) -> AnyCalendarItemModel?)
    -> Self
  func dayOfWeekItemProvider(
    _ dayOfWeekItemProvider: @escaping (
      _ month: Month?,
      _ weekdayIndex: Int)
      -> AnyCalendarItemModel?)
    -> Self
  func dayItemProvider(_ dayItemProvider: @escaping (_ day: Day) -> AnyCalendarItemModel?) -> Self
}

extension CalendarViewContent: CalendarContentConfigurable { }

extension CalendarViewRepresentable: CalendarContentConfigurable { }

This requires the two types having the same method signatures, which we changed unintentionally #269.

This PR updates CalendarViewRepresentable to match the changes applied to CalendarViewContent in #269.