A convenient event kit written by Swift 2.0.
Using TTEventKit in your project requires the following steps:
In your top-level project directory, enter this:
git submodule add https://github.com/tattn/TTEventKit.git
- Open the
TTEventKit
folder, and dragTTEventKit.xcodeproj
into the project navigator of your project. - Select the project file from the project navigator, and select the target for where you want to add frameworks.
- Select the "Build Phases" tab, and add
TTEventKit.framework
to "Link Binary With Libraries". - Click on the "+" button at the top left of the panel and select "New Copy Files Phase".
- Open the "Copy Files", and set the "Destination" to "Frameworks", and add
TTEventKit.framework
.
import TTEventKit
EventStore.requestAccess() { (granted, error) in
if granted {
println("got permission")
}
}
let events = EventStore.getEvents(Month(year: 2015, month: 1))
if events != nil {
for e in events {
println("Title \(e.title)")
println("startDate: \(e.startDate)")
println("endDate: \(e.endDate)")
}
}
let start = NSDate()
let end = NSDate(timeIntervalSinceNow: 60*60)
EventStore.addEvent("new event", notes: "This is a test", startDate: start, endDate: end)
EventStore.removeEvents(year: 2016, month: 1)
EventStore.removeEvents(year: 2016, month: 1, day: 1)
// remove events from 1/5/2016 to 1/19/2016
EventStore.removeEvents(year: 2016, month: 1, day: 5, length: 15)
// simple
EventUI.showEditView()
// preset
let event = EventStore.create()
event.title = "new event"
event.notes = "memo"
EventUI.showEditView(event)
// update
let month = Month(year: 2016, month: 10)
let event2 = EventStore.getEvents(month, day: 1)[0]
EventUI.showEditView(event2)
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
TTEventKit is released under the MIT license. See LICENSE for details.