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
View for notification #122
Comments
Hi @grosch, CalendarKit was meant to be a set of separate modules, so you could use it to create your own UI components. For your task, I'd recommend using just TimelineView, it should serve the purpose perfectly. If you'd like to have a higher-level abstraction over TimelineView, you may wrap it into TimelineContainer to support scrolling to specific hour or the first event. |
Thanks, @richardtop. Could you give a bit more of a specific example please? I'm looking at TimeLineView and none of the stuff in there is public so I'm not sure how to use this by itself. |
At first, I recommend you taking a look at the "parent" view, i.e. TimelinePagerView. The method important for us is updateTimeline: func updateTimeline(_ timeline: TimelineView) {
guard let dataSource = dataSource else {return}
let date = timeline.date.dateOnly()
let events = dataSource.eventsForDate(date)
let day = TimePeriod(beginning: date,
chunk: TimeChunk.dateComponents(days: 1))
let validEvents = events.filter{$0.datePeriod.overlaps(with: day)}
timeline.eventDescriptors = validEvents
} The last line shows, how the information in form of [EventDescriptor] is passed to the Timeline. Also, you'll need to position your view in the parent view, i.e. set it's frame's let hourToScroll = 18 // Scroll to 18:00
let fullHeight = timeline.fullHeight
let yOffset = fullHeight * hourToScroll/24
timeline.frame = CGrect(x: 0, y: yOffset, width: ...., height: ...) |
Thanks. Still not there though. Everything seems to be internal variables. I can put a |
Is there any chance you can just provide an example view controller that displays a day view set to a specific date with some events? |
I'll send you an example in a moment. |
Thanks! Please remember to update the cocoapod as well. It's still pulling 0.2.1 |
Done. Feel free to close this issue, if you don't have other questions related to the Notification view. |
Thanks much. I've almost got this working now. Might need to make a couple more things public, like is24hClock. I'll open a new item on what I'm finding though. |
This looks like an awesome library. Is there a way to customize the view so it just shows the time around a specific timeframe? I'd like to use this in a custom UI for a rich push notification but obviously I don't want to show the whole day, just a couple hours before and after the event that's pushed to the user.
The text was updated successfully, but these errors were encountered: