richardtop / CalendarKit

📅 Calendar for Apple platforms in Swift
https://www.youtube.com/watch?v=cJ63-_z1qg8
MIT License
2.52k stars 340 forks source link

I just need Timeline view not with the calendar. Is there any possibilities? #226

Closed SunnyBamaniya closed 4 years ago

SunnyBamaniya commented 4 years ago

New Issue Checklist

Issue Description

Code I'm using with CalendarKit

[INSERT CODE HERE]

Result I am trying to achieve

[INSERT API OR UI MOCKUPS HERE]

richardtop commented 4 years ago

Hi, just use the components then, not the whole DayViewController. See example in ExampleNotificationController

SunnyBamaniya commented 4 years ago

Thanks @richardtop for the reply. I used ExampleNotificationController but now we need to add Multiple events without using calendar.

Can you please just help to come out from the issue. Thanks.

richardtop commented 4 years ago

Please, attach the screenshot or mockup of what you're trying to achieve.

richardtop commented 4 years ago

It doesn't show one event at a time, please check examples. It shows any number of events you pass by the DayViewDataSource.

richardtop commented 4 years ago

What is the contents of the array?

Sent with GitHawk

SunnyBamaniya commented 4 years ago

How can we increase spacing (height) between to hours like 9:00 AM to 10:00?

image

richardtop commented 4 years ago

Take a look into verticalDiff property of the CalendarStyle

Sent with GitHawk

SunnyBamaniya commented 4 years ago

image

this is our code and we are unable to view multiple data using Only "TimelineContainer" Can you just late us where i am wrong.

i also attach json file here. JSON.txt

richardtop commented 4 years ago

Please, configure an example project and attach it here, so I could run it locally.

SunnyBamaniya commented 4 years ago

Hello Richardtop, Here i attach sample project. also let us know how can i get value of selected timeline.

Thanks

SampleTesting.zip

SunnyBamaniya commented 4 years ago

Hello @richardtop Can have any feedback on above example?

richardtop commented 4 years ago

Hi, I hope to check it next week.

richardtop commented 4 years ago

SampleTesting.zip @SunnyBamaniya you had an error in layout. Please, learn more about UIKit and how to do manual / auto layout. I fixed your issue to make the Calendar occupy the whole view.

If you have CalendarKit-specific questions, feature requests or bug reports (e.g. something doesn't work, or you'd like to have new features implemented) feel free to ask them here.

However, if your question is a generic programming questions (e.g. how to compose multiple views to achieve some result), it's better to ask it on the StackOverflow with tag CalendarKit. You might get help faster there.

EAmey commented 4 years ago

Hi, just use the components then, not the whole DayViewController. See example in ExampleNotificationController

Hey @richardtop

I tried this solutions and it's working perfectly. But is it possible to add multiple event for same datetime. Currently I have added 2 events and second one is with large duration but its overlapping first one. Can you help on this?

richardtop commented 4 years ago

Send a screenshot please. Definitely should be possible.

Sent with GitHawk

SunnyBamaniya commented 4 years ago

Hi @EAmey Can you share your example? How you set 2 events using ExampleNotificationController.

SunnyBamaniya commented 4 years ago

Hello @richardtop I just want to add multiple events using ExampleNotificationController.

here I tried in ViewController.swift but unable to add multiple events. SampleCalendar.zip

EAmey commented 4 years ago

@SunnyBamaniya Please find code as below

 lazy var timelineContainer: TimelineContainer = {
        let timeline = TimelineView()
        timeline.frame.size.height = timeline.fullHeight
        timeline.eventViewDelegate = self
        var currentCalendar = Calendar(identifier: .gregorian)
           currentCalendar.locale = Locale.current
           currentCalendar.timeZone = TimeZone.current

        timeline.calendar = currentCalendar
        let timelineStyle = TimelineStyle()
        timelineStyle.dateStyle = .twelveHour
        //timelineStyle.verticalDiff = 60.0
        timeline.updateStyle(timelineStyle)
        let container = TimelineContainer(timeline)
        container.contentSize = timeline.frame.size
        container.backgroundColor = .white
        container.addSubview(timeline)
        container.isUserInteractionEnabled = true
        return container
      }()

 func getEventDataForDate()
    {
        timelineContainer.timeline.date = self.dateSelected ?? Date()
        timelineContainer.timeline.layoutAttributes.removeAll()
        if let arrTask = TimesheetTasks.getEventsForDate(date: timelineContainer.timeline.date)
             {

                for task in arrTask
                {
                    //working with 12 hours format only

                  let event = Event()
                    event.startDate = task.startTime
                    event.endDate = task.endTime
                      event.textColor = .white
                      event.color = .red

                    var info = ["\(task.taskName ?? "Task")"]
                    info.append("\(task.projectName ?? "Project")")
                        info.append("\(task.startTime.format(with: "hh:mm")) - \(task.endTime.format(with: "hh:mm"))")
                        event.text = info.reduce("", {$0 + $1 + "\n"})

                    arrEvents.append(EventLayoutAttributes(event))
                }
                timelineContainer.timeline.layoutAttributes = arrEvents

                return
             }
}
SunnyBamaniya commented 4 years ago

Hello @richardtop How can we configure timing instead of 12 am - 12 am to 09 AM - 06 PM?

richardtop commented 4 years ago

Currently it's impossible (see #34). If you don't have any further questions, I'll close this issue.