Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/albertmontserrat/amgcalendarmanager
EventKit helper for Swift 3
https://github.com/albertmontserrat/amgcalendarmanager
ekevent eventkit ios pod swift swift-3
Last synced: about 2 months ago
JSON representation
EventKit helper for Swift 3
- Host: GitHub
- URL: https://github.com/albertmontserrat/amgcalendarmanager
- Owner: AlbertMontserrat
- License: mit
- Created: 2017-02-16T10:43:52.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-12T13:36:02.000Z (over 7 years ago)
- Last Synced: 2024-10-14T22:21:34.594Z (3 months ago)
- Topics: ekevent, eventkit, ios, pod, swift, swift-3
- Language: Swift
- Homepage:
- Size: 39.1 KB
- Stars: 30
- Watchers: 5
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AMGCalendarManager
[![CI Status](http://img.shields.io/travis/Albert/AMGCalendarManager.svg?style=flat)](https://travis-ci.org/Albert/AMGCalendarManager)
[![Version](https://img.shields.io/cocoapods/v/AMGCalendarManager.svg?style=flat)](http://cocoapods.org/pods/AMGCalendarManager)
[![License](https://img.shields.io/cocoapods/l/AMGCalendarManager.svg?style=flat)](http://cocoapods.org/pods/AMGCalendarManager)
[![Platform](https://img.shields.io/cocoapods/p/AMGCalendarManager.svg?style=flat)](http://cocoapods.org/pods/AMGCalendarManager)## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
## Installation
AMGCalendarManager is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod "AMGCalendarManager"
```Remember to add the reason in Info.plist with the key "Privacy - Calendars Usage Description".
## How it works
AMGCalendarManager works as a singleton and generates a new Calendar with the Bundle Name.
Basic example:
```
AMGCalendarManager.shared.createEvent(completion: { (event) in
guard let event = event else { return }event.startDate = date
event.endDate = event.startDate.addingTimeInterval(60 * 60 * 1) // 1 hourevent.title = name
event.notes = notes
AMGCalendarManager.shared.saveEvent(event: event)})
```To get all events saved in this calendar:
```
AMGCalendarManager.shared.getAllEvents(completion: { (error, events) in})
```You can also get on event by id, delete one or all events, etc.
```
public var eventStore: EKEventStorepublic let calendarName: String
public var calendar: EKCalendar? { get }
static internal let shared: AMGCalendarManager.AMGCalendarManager
public func createEvent(completion: ((_ event: EKEvent?) -> Void)?)
public func saveEvent(event: EKEvent, completion: ((_ error: NSError?) -> Void)? = default)
public func removeEvent(eventId: String, completion: ((_ error: NSError?) -> ())? = default)
public func removeAllEvents(completion: ((_ error: NSError?) -> ())? = default)
public func getAllEvents(completion: ((_ error: NSError?, _ events: [EKEvent]?) -> ())?)
public func getEvents(startDate: Date, endDate: Date, completion: ((_ error: NSError?, _ events: [EKEvent]?) -> ())?)
public func getEvent(eventId: String, completion: ((_ error: NSError?, _ event: EKEvent?) -> ())?)
public func commit() -> Bool
public func reset()
```## Author
Albert, [email protected]
## License
AMGCalendarManager is available under the MIT license. See the LICENSE file for more info.