EKEventStoreWrapper 0.9.96

EKEventStoreWrapper 0.9.96

测试已测试
Lang语言 SwiftSwift
许可 MIT
Released最后发布2016年6月
SPM支持 SPM

Bruno Henriques 维护。



EKEventStoreWrapper

EKEventStoreWrapper

目标是简化 EKEventStore 的使用

let calendarManager = CalendarManager(calendarName: "CalendarTest")

calendarManager.requestAuthorization({(error: NSError?) in
    if let theError = error {
        println("Authorization denied due to: \(theError.localizedDescription)")
        return
    }

    self.calendarManager.addCalendar(completion: {(wasSaved: Bool, error: NSError?) in
        if wasSaved {
            println("Success creating calendar")
        }else {
            if let theError = error {
                println("Wasn't able to create calendar because: \(theError.localizedDescription)")
            }
        }
    })
})

calendarManager.requestAuthorization() {(error: NSError?) in
    if let theError = error {
        println("Authorization denied due to: \(theError.localizedDescription)")
        self.openSettings()
    }else {
        if let event = self.calendarManager.createEvent() {
            event.title = "Meeting with Mr.\(Int(arc4random_uniform(2000)))"
            event.startDate = NSDate()
            event.endDate = event.startDate.dateByAddingTimeInterval(Double(arc4random_uniform(24)) * 60 * 60)

            //other options
            event.notes = "Don't forget to bring the meeting memos"
            event.location = "Room \(Int(arc4random_uniform(100)))"
            event.availability = EKEventAvailabilityFree

            self.calendarManager.insertEvent(event) {(wasSaved: Bool, error: NSError?) in
                if wasSaved {
                    self.refreshEvents()
                    println("Success adding event")
                }else {
                    if let theError = error {
                        println("Wasn't able to add event because: \(theError.localizedDescription)")
                    }
                }
            }
        }
    }
}

演示

在示例文件夹中包含一个演示,展示了开发的功能。

安装

1 - 在 Podfile 中

pod 'EKEventStoreWrapper', :git => 'https://github.com/bphenriques/EKEventStoreWrapper.git', :tag => '0.9.8'

2 - 运行

pod install