Latest 0.0.2
Homepage https://github.com/tattn/TTEventKit
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit, Foundation, QuartzCore
Authors

A convenient event kit written by Swift 2.0.


Calendar

Calendar

Installation

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
  1. Open the TTEventKit folder, and drag TTEventKit.xcodeproj into the project navigator of your project.
  2. Select the project file from the project navigator, and select the target for where you want to add frameworks.
  3. Select the "Build Phases" tab, and add TTEventKit.framework to "Link Binary With Libraries".
  4. Click on the "+" button at the top left of the panel and select "New Copy Files Phase".
  5. Open the "Copy Files", and set the "Destination" to "Frameworks", and add TTEventKit.framework.

Usage

Getting permission to access calendar events

import TTEventKit

EventStore.requestAccess() { (granted, error) in
    if granted {
        println("got permission")
    }
}

Getting calendar events

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)")
    }
}

Adding calendar events

let start = NSDate()
let end = NSDate(timeIntervalSinceNow: 60*60)
EventStore.addEvent("new event", notes: "This is a test", startDate: start, endDate: end)

Removing calendar events


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)

Showing the view to edit an event

// 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)

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

TTEventKit is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "TTEventKit",
    "version": "0.0.2",
    "summary": "a very useful EventKit library.",
    "homepage": "https://github.com/tattn/TTEventKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Tatsuya Tanaka": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/tattn/TTEventKit.git",
        "tag": "v0.0.2"
    },
    "source_files": "TTEventKit/TTEventKit/*.{swift,h}",
    "exclude_files": "Classes/Exclude",
    "public_header_files": "TTEventKit/TTEventKit/TTEventKit.h",
    "frameworks": [
        "UIKit",
        "Foundation",
        "QuartzCore"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This