GithubHelp home page GithubHelp logo

thasianx / elegantcalendar Goto Github PK

View Code? Open in Web Editor NEW
817.0 13.0 91.0 30.56 MB

The elegant full screen calendar missed in SwiftUI.

License: MIT License

Swift 100.00%
calendar swiftui ios-animation swift-package-manager elegantcalendar swiftui-animations swiftui-components swiftui-example

elegantcalendar's People

Contributors

sethi-ishmeet avatar sunoj avatar thasianx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elegantcalendar's Issues

Missing Calendar

Have you seen any issues when using 2 MonthlyCalendars in a single app? I am using one instance for schedule data and a separate instance with its own data and behavior for event data. When I do this both calendars disappear. As soon as I comment out one of the calendars, then the other works properly.
Screen Shot 2020-08-22 at 6 20 39 PM

Segue from calendar date to another page

I can not figure out how to segue from the visit list cell to another view controller when I add a tap gesture recognizer to this part of the code. I would like to be able to go to another page on my app once the user selects a certain appointment on a date. Thank you

var visitsPreviewList: some View {

    VStack(spacing: 0) {
        ForEach(visits[range]) { visit in
            VisitCell(visit: visit)
                .gesture(TapGesture().onEnded {
                    //Would like to segue to another ViewController here
                    print(visit.uid)
                })
        }
    }
}

Title do not show up

Hi guys, I just got the code of the demo and customised as needed. Sent that code to another project and got that:

Screenshot 2021-02-12 at 15 27 15

I can not find any reason for that. I am using the kiwiGreen theme.

`let configuration = CalendarConfiguration(
calendar: currentCalendar,
startDate: ascVisits.first!.theDate,
endDate: ascVisits.last!.theDate)

        calendarManager = ElegantCalendarManager(
            configuration: configuration,
            initialMonth: initialMonth)

        visitsByDay = Dictionary(
            grouping: ascVisits,
            by: { currentCalendar.startOfDay(for: $0.theDate) })

        calendarManager.datasource = self
        calendarManager.delegate = self

`

`
var body: some View {
VStack {

           ElegantCalendarView(calendarManager: calendarManager)
            .theme(calendarTheme).horizontal()
        Spacer()
       }
   }

`

Maybe, the NavigationView?

iOS 15 Warnings in Xcode 13 when using ElegantCalendar

Issue
When running the Example project with Xcode 13, I am getting warnings in the console log:

ForEach<Array<String>, String, ModifiedContent<ModifiedContent<Text, _FrameLayout>, _EnvironmentKeyWritingModifier<Optional<Color>>>>: the ID T occurs multiple times within the collection, this will give undefined results!

There are six of these in a series logged the calendar is displayed.

iOS Version
This only happens when running against iOS 15. When I run against a simulator in iOS 14, it is quiet and I only get the expected messages from the Example project.

(This too is happening from my app that uses this package, but was easier and cleaner to verify this behavior in the include Example here).

I will try to hunt this down, but maybe someone else already has a solution. The calendar does appear to be working iOS 15 despite these warnings, but worry something in SwitUI may break the cause of this in the future.

Be able to change spacing between the rows of the calendar.

I am running into an issue where I have an app with a Navigation bar at the top and a toolbar at the bottom. When I put the calendar on the page it takes up a lot of the page. So If there were different options for spacing vertically that would be great!

how to add color coded for specific days ?

I want to add a color code on important dates, both in month and whole year view. is it possible?

is it possible to have an array of dates to be colored on the calender differently? pls add if cant ty.

Dynamic 'startDate' and 'endDate'

Is there any way to change startDate and endDate dynamically?

I was looking into the source code and found a line in CalendarConfiguration.swift: "/// Any changes to the configuration will reset the calendar based on its new settings"

But I didn't understand how to do it. First, the CalendarConfiguration have let property itself in MontlyCalendarManager and in the CalendarConfiguration struct the startDate and endDate properties are also have let

When I change them to var, the dates changes, but the months remain the same. In which direction should I move?

@State variable not updated in func calendar(didSelectDay date: Date)

First, thank you for the beautiful calendar.

I have a @State variable declared as

@State var selectedDate : Date = Date()

I attempt to change that as follows

func calendar(didSelectDay date: Date) { self.selectedDate = date print(selectedDate) }

The variable is never updated even though it goes through the code and no error is reported. Any ideas?

Full screen calendar with horizontal scroll on months.

Hi, I am evaluating multiple SwiftUI Customizable calendar libraries to use with my new app. I would want to achieve something like this image below. Would it be possible to achieve this using ElegantCalendar? If yes, what's the path should I be taking to do this? Happy to contribute as well if something is missing.

Thanks in advance.

IMG_4D182DB6382F-1

Navigation issue

Thank you for the beautiful library. When you open the library for navigation, it shows the month, and when you press back, it returns to the year display and then goes to the other screen.

Wrong layout when use with UIKit

Try to use Calendar with UIKit and I see a lot of artefacts,

For example year calendar,
Screenshot 2020-08-22 at 19 05 35

Padding from top and bottom 100 points,
Month name is cut
Months in two columns

Similar with month calendar,
Screenshot 2020-08-22 at 19 09 07

Month name out of frame around 100 points.
Content is cut too

Days of the Week appear correctly on Simulator but not on device.

Great job on developing this project. The calendar looks wonderful!

I am experiencing a strange issue with the example project where the start of the month doesn't match up with the actual days of the week in the Monthly Calendar view.
Here is the screenshot from my simulator:
Simulator Screen Shot - iPod touch (7th generation) - 2021-03-03 at 15 45 48

As you can see, today is Wednesday 3 March 2021 and the calendar view is aligned correctly with the days of the week.

However, when I run the example project on my iPhoneX it shows this:
IMG_2B5E38DCFEF7-1

As you can see, it aligns today's date(Wednesday 03 March 2021) with Tuesday rather than Wednesday.

I haven't changed any code yet the CalendarView displays differently on Simulator and device. What could be causing this?

EventKit event and EKRecurrence rule

Hi ThasianX, I want to display event of EventKit with recurrence in calendar, can ElegantCalendar display recurrence event? how to implement recurrence event?

Incorrent week days in regions with first week day other than sunday

I am a new user user to ElegantCalendar, but I have noticed that the legend for week days don't match the actual week day of dates.
In my region monday is the first day of the week, but on top of the calendar it still shows "S M T W T F S", but it should show "M T W T F S S" as the days are shown in the correct "column" (monday is first in this case).

ElegantCalendar

Error: `ElegantCalendar.xcassets` doesn't exist

I imported library by using Swift packages. After add ElegantCalendarView to view's body, I received fatalError at Image+Custom.swift file at line 9. I found that "uturn.left" image is already existed in ElegantCalendar.xcassets. please tell me how can I fix this?

reload data

When I fetched data from server, what I should do to reload datasource

ColorTheme not applied.

I used to reproduce the example but get unwanted behaviour, if anyone could help I will appreciate it!

The toy code is

import SwiftUI
import ElegantCalendar

struct TestCal: View {
    @ObservedObject private var calendarManager: MonthlyCalendarManager
    @State private var calendarTheme: CalendarTheme = .red
    
    let currentCalendar = Calendar.current
    
    
    init(startTime: Date, endTime: Date) {
        
        let cfg = CalendarConfiguration(calendar: currentCalendar,
                                        startDate: startTime,
                                        endDate: endTime)
        calendarManager = MonthlyCalendarManager(configuration: cfg, initialMonth: nil)

        calendarManager.datasource = self
        calendarManager.delegate = self
    }
    
    var body: some View {
        VStack {
            MonthlyCalendarView(calendarManager: calendarManager)
                .theme(calendarTheme)
                .axis(.horizontal)
        }
    }
}


extension TestCal: MonthlyCalendarDataSource {
    func calendar(backgroundColorOpacityForDate date: Date) -> Double {
        return 0.9
    }
    
    func calendar(canSelectDate date: Date) -> Bool {
        let day = currentCalendar.dateComponents([.day], from: date).day!
        return day != 4
    }
    
    func calendar(viewForSelectedDate date: Date, dimensions size: CGSize) -> AnyView {
        return Text("Text").erased
    }
}

extension TestCal: MonthlyCalendarDelegate {
    
    func calendar(didSelectDay date: Date) {
        print("Selected date: \(date)")
    }
    
    func calendar(willDisplayMonth date: Date) {
        print("Will show month: \(date)")
    }
    
}

func dateInit () -> DateFormatter {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "yyyyMMdd"
    dateFormatter.locale = Locale(identifier: "en_US")
    dateFormatter.timeZone = TimeZone.current
    return dateFormatter
}

let dateFormatter = dateInit()
let thisTime = "20221102"
let thatTime = "20230111"


struct TestCal_Previews: PreviewProvider {
    static var previews: some View {
        TestCal(
            startTime: dateFormatter.date(from: thisTime)!, endTime: dateFormatter.date(from: thatTime)!

        )
        
    }
}

As shown in the preview, the protocol MonthlyCalendarDataSource's func calendar(backgroundColorOpacityForDate date: Date) not worked, or the theme is not loaded.

image

Change Circle Color when Date is Clicked

I used your package in xcode 14 and I wanted to edit the CircularSelectionView in DayView but isee that the Circle() color is set to color.primary. Any ideas how to edit this Circle? Trying to edit the Theme to my own color and Successfull, but i cant change this bounce circle

image

Any programmatic way to tighten up the vertical white space?

I would like to tighten up some of the vertical whitespace between rows a bit, particularly for smaller devices. Its a beautiful layout as is, but on smaller devices, it does not leave much room for the aux view at the bottom.

Is there any programmatic way to do that? i tried changing the frame height of the MonthlyCalendar view, but that just gave me weird results.

What am I missing?

.frame() modifier shifts the calendar to the right if used with .horozontal() scrolling

Hi,

I saw the horizontal monthly calendar scrolling was implemented recently which is cool. Although when you apply .frame() modifier to MonthlyCalendarView it is being shifted to the right. Please see the screenshot. I guess it is related to ElegantPages? Could you point me in the right direction and I would try to find the issue.

I am new to coding and it's the first time I submit an issue, please tell me if I did something wrong.
It's a very cool calendar library, trying to implement it in the habit tracker app I am working on.

Screenshot 2020-08-06 at 21 53 32

Visits load on click event

How to append visit array when click on date. not on first show up.

I want to set null visit data on first. but when click specify date, i will request to server to get list of meeting.

Is it posible . . ?

Thanks..

Problem with Date 4th

why is at every 4th of every month, there's always problems?

date cannot be clicked and color same with day of other month

Thanks..

Any way to move the calendar up the screen?

Body of view:

var body: some View { MonthlyCalendarView(calendarManager: calendarManager) .theme(CalendarTheme(primary: Color.mFoodColor)) .allowsHaptics(true) .horizontal() // .offset(x: 0.0, y: -50.0) .navigationTitle("Schedule") }

Screen Shot 2020-08-20 at 5 16 43 PM

There is a big whitespace above the Month name. I have tried adding Spacer() in various places. The only way I have been able to change this is to use the .offset that is commented out in the above code.

Are there better ways to correct this?

Minimum deploy target

Hi, I was worrying if there's a way to use this calendar for lower versions of iOS such as 11.4 or at least 12 instead of 13 (even though the major part of iOS user are above 13, there are some still in 12.
Thanks beforehand.

Resolving ElegantPages fails

Hi, I'm trying to add ElegantCalendar as a Swift Package, but it keeps failing when it tries to resolve "Elegant Pages"

startDate and endDate not recognized in example code.

I have installed the package according to the ReadMe instructions, but when I create a new swift file containing the sample code, the default values for startDate and endDate throw errors.
Screen Shot 2020-08-06 at 6 54 37 AM

Am I missing something in the instructions? It seems like according to the docs that just executing this should default the start and end dates to todays value. Is there something that needs to be done here that isn't explicitly shown in ReadMe?

Crashes in setProperPage()

Hello, I am getting random crashes. They start in the setProperPage() where the class is called "UpdateUIViewControllerBugFixClass". Here's the code where it finally crashes:

 func configureNewMonth(at page: Int) {
        if months[page] != currentMonth {
            currentMonth = months[page]
            selectedDate = nil

            delegate?.calendar(willDisplayMonth: currentMonth)

            if allowsHaptics && isHapticActive {
                UIImpactFeedbackGenerator.generateSelectionHaptic()
            } else {
                isHapticActive = true
            }
        }
    }

For some reason the page passed is like 26,000. Any ideas on how to fix this? Apparently the creator was trying to solve a bug but it seems it is not resolved.

Collapse to week

Hi, would it be possible to collapse the calendar view to see only the week instead of the whole month? This way there would be more space for content.
Something similar to this from FSCalendar:
image

Thank you

Buttons for month switching

It would be nice to have buttons at either side on the month title in the MonthCalenderView so the header would look something like this:
< September >
Selecting the corresponding arrows would move between months accordingly.

How could I add these buttons so users don't have to swipe to move between months?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.