Skip to content

Synchronize your app with system events and calendars

Notifications You must be signed in to change notification settings

Marck100/SyncKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SyncKit

SyncKit allows you to synchronize system events and calendars with your database.

How to implement this package

  1. Conform your Event and Calendar class to SKEvent and SKCalendar
class Event: SKEvent {
   
   var title: String
   var eventIdentifier: String
   
   var lastModifiedDate: Date?
   ...
   
    func toEKEvent() -> EKEvent {
        if let event = store.event(withIdentifier: eventIdentifier) {
            event.title = title
            ...
            return event
        } else {
            let event = EKEvent(eventStore: store)
            ...
            return event
        }
    }
    
}
  1. Request access to event( You must implement Privacy keys in your info.plist )
  2. Compare events and calendars stored in your app with system ones.
let comparison = SKCenter.shared.compareCalendars(calendars: systemCalendars, storedCalendars: storedCalendars)
  1. Update your app
db.save(comparison.calendarsToSave)
db.update(comparison.calendarsToUpdate)
db.remove(comparison.calendarsToDelete)

About

Synchronize your app with system events and calendars

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages