1

I've tried to replicate the "Usage" section of CalendarKit's documentation and I simply can't get the EventView.data when the user selects an EventView.

My controller conforms to DayViewController and the EventViews display normally on the DayView on my screen.

override func dayViewDidSelectEventView(_ eventview: EventView) {
    print("Event has been selected: \(eventview.data)")
}

This is the method being executed when the user presses the EventView and the only problem is that "eventview has no member data". I've checked the definition of the library class and it really has no data member or no methods that would extract the event or anything.

Basically the question is - How do I get the event data here?

I understand that this is simple and I thank you for sparing some time in order to help.

Ivor Baric
  • 11
  • 1

1 Answers1

0

thank you for your question. The documentation is not up-to-date, I'll make sure to update it.

Please, use the following approach to get the EventDescriptor which would help you identify the event in your application model layer. For example, you could use userInfo dictionary to store an event identifier.

  override func dayViewDidSelectEventView(_ eventView: EventView) {
    guard let descriptor = eventView.descriptor as? Event else {
      return
    }
    print("Event has been selected: \(descriptor) \(String(describing: descriptor.userInfo))")
// You can use the userInfo dictionary to identify which event has been selected
  }
  
Richard Topchii
  • 7,075
  • 8
  • 48
  • 115