Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: moveTo(event:) or Select Event programmatically, similar to moveTo(date:) #289

Open
boominadhapm opened this issue Nov 18, 2020 · 2 comments

Comments

@boominadhapm
Copy link

boominadhapm commented Nov 18, 2020

Hi,

Thanks for the nice library. I just want to clarify my doubt which is required for my project implementation.

Currently I am using this library in my project to load the calendar events. But now I am having requirement like, I need to load the events on particular date and move/select to the particular event automatically while loading the events.

Let me know, Is it possible?

Thanks,
Boominadha Prakash

@richardtop
Copy link
Owner

Hi, this is not available. Please take a look here:

setTimelineOffset(CGPoint(x: contentOffset.x, y: yToScroll - padding), animated: animated)

I suggest you implement this feature and suggest a pull request.
For example, you could start by defining an API on the DayViewController and all the way up to the Timeline:

func scrollToEvent(event: EventDescriptor, animated: Bool)

Or even

func scrollToEvent(event: EventDescriptor, at:ScrollPosition (top/middle/bottom/auto) animated: Bool)

Then, in the Timeline calculate the y(coordinate) of the event and scroll to it in the method I've shown.

You could add a method similar to this:

public var firstEventYPosition: CGFloat? {

to the Timeline and return the y value of any event:

frameForEvent(event: EventDescriptor)

Another approach to finding just a y value without knowing the whole frame would be just using this function:

public func dateToY(_ date: Date) -> CGFloat {

If you're interested, I'm looking forward to your pull request.

@boominadhapm
Copy link
Author

Hi @richardtop

Thanks for the detailed explanation. I will check it and if possible, I will implement and create a pull request.

@richardtop richardtop changed the title Like moveTo(date:), Is it moveTo(event:) or Select Event functionality available? API: moveTo(event:) or Select Event programmatically, similar to moveTo(date:) Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants