GithubHelp home page GithubHelp logo

Stuck about calendarkit HOT 4 CLOSED

R35Master avatar R35Master commented on May 25, 2024
Stuck

from calendarkit.

Comments (4)

R35Master avatar R35Master commented on May 25, 2024

I have edited the code and this is how it looks like `

func getEvents() {
    
    self.db.collection(XX).document(XX).collection("Calendar").addSnapshotListener { [self] (querySnapshot, error) in
        
        self.userEventBox = []
        
        if let e = error {
            print("There was an issue retrieving data from Firestore. \(e)")
        } else {
            
            if let snapshotDocuments = querySnapshot?.documents {
                
                for doc in snapshotDocuments {
                    
                    let data = doc.data()
                    if let title = data["title"] as? String ,
                       let startDate = data["startDate"] as? String ,
                       let endDate = data["endDate"] as? String ,
                       let isAllDay = data["isAllDay"] as? Bool
                    {
                        let newEventBox = EventBox(startDate: startDate, endDate: endDate, isAllDay: isAllDay, title: title)
                        self.userEventBox.append(newEventBox)
                        print(newEventBox)
                        self.generate()
                    }
                }
            }
        }
    }
}


func generate() {
    
    for generation in userEventBox {
        
        let isoStartDate = generation.startDate
        let isoEndDate = generation.endDate
        
        let dateFormatter = ISO8601DateFormatter()
        let startDate = dateFormatter.date(from:isoStartDate)!
        let endDate = dateFormatter.date(from:isoEndDate)!
        
        if let event = EKEvent() as? EKEvent {

        event.title = generation.title
        event.isAllDay = generation.isAllDay
        event.startDate = startDate
        event.endDate = endDate
        event.calendar.cgColor = CGColor(red: 1, green: 1, blue: 1, alpha: 1)
            self.generated = [event]
        }
        
    }
}

var generated = [EKEvent()]
override func eventsForDate(_ date: Date) -> [EventDescriptor] {
    
    self.getEvents()
    
    let calenderKitEvents = generated.map(EKWrapper.init)
    
    return calenderKitEvents
}

}
`

Now I have this error Thread 1: "You must use [EKEvent eventWithEventStore:] to create an event"

I will really lose my mind. Please help @richardtop

from calendarkit.

richardtop avatar richardtop commented on May 25, 2024

Please post on stackoverflow first.

from calendarkit.

R35Master avatar R35Master commented on May 25, 2024

https://stackoverflow.com/questions/73408161/you-must-use-ekevent-eventwitheventstore-to-create-an-event @richardtop

from calendarkit.

richardtop avatar richardtop commented on May 25, 2024

Let's continue there.

from calendarkit.

Related Issues (20)

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.