Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Status: New
Turn off auto-scrolling when calling IGCalendarView.invalidate

I'm using IGCalendarView's day view in a drag-and-drop scenario in iOS 11+. I have a custom appointment store that I am maintaining in a Realm database and I created a custom appointment data source to turn these events into IGCalendarAppointment objects that are being displayed in the day view.

When (a) the drop operation happens, or (b) I create an appointment from elsewhere in my application, the parent view controller is receiving a notification from Realm to tell me that the set of appointment objects has changed, and I call IGCalendarKit.invalidate() to get the calendar control to update. That works well.

In my specific problem scenario, I have a horizontal StackView with IGCalendarKit in the left pane in day view mode, and a table view with a list of "to do" tasks in the right pane. The user can tap and hold on one of the "to do" tasks which activates drag-and-drop, and then drag the task over to the calendar where I create a 30 minute appointment for the user to work on the "to do" task.

Let's assume that it's 8am and the user drags a task to 4pm, which is off of the screen. IGCalendarView automatically scrolls down to bring up the time and my drop handler accepts the drop and creates the appointment. However, when I call IGCalendarView.invalidate() to show the new appointment, the day view scrolls back to 8am (I set dayViewInitialScrollLocation to specificHour, which is the current hour of the day). The user has to scroll up to see the new appointment that was just dropped/created.

I thought about working around it by adjusting the dayViewInitialScrollStartHour, but there will still be some amount of scrolling that happens, which makes the UI feel a little funky. I'd like the new appointment to just be visible without scrolling.

Would it be possible to get a new overload of invalidate() that gives the option of turning off auto-scrolling for the invalidation and uses the current scroll offset? Something like invalidate(shouldAutoScroll: Bool)?