Simplifies iOS user permission requests (location, push notifications, camera, contacts, calendar, photos, etc).

Related tags

Calendar ICanHas
Overview

ICanHas

Swift 4 library that simplifies iOS user permission requests (push notifications, location, camera, photo library, contacts, calendar).

Installation

Just add ICanHas.swift to your Xcode project (I know, I know).

Usage

Use the provided method every time you need to make sure that the app has permissions to access the corresponding service. The first time a function is called, it may prompt the user to allow that service on a native alert view. See the examples below

Location:

ICanHas.location { authorized, status in
    print(authorized ? "You're authorized to use location!" : "You're not authorized to use location!")
}

๐Ÿ’ก You may specify whether you would like the app to be able to access location while in the background, and/or the location manager you will be using, as follows:

let myManager = CLLocationManager()
ICanHas.location(background: false, manager: myManager) { ... }

๐Ÿ’ก Also make sure to add the NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription key to your Info.plist file. More info here.

Push Notifications:

ICanHas.push { authorized in
    print(authorized ? "You're authorized to send push notes!" : "You're not authorized to send push notes!")
}

๐Ÿ’ก This function has one optional parameter types: UIUserNotificationType which specifies the user notification types for which you would like the app to be registered. The default value includes all types [.alert, .badge, .sound].

๐Ÿ’ก For this authorization to work, you will need to run your app on a device (the simulator cannot register for push notifications) and make sure you have all the necessary provisioning and certificates. More info here.

Calendar:

ICanHas.calendar { authorized, status, error in
    print(authorized ? "You're authorized to access the calendar!" : "You're not authorized to access the calendar!")
}

๐Ÿ’ก You may optionally specify an EKEventStore and/or an entity type. For example:

let myStore = EKEventStore()
ICanHas.calendar(store: myStore, type: .event) { ... }

Capture (Camera, Microphone, etc):

ICanHas.capture { authorized, status in
    print(authorized ? "You're authorized to access the camera!" : "You're not authorized to access the camera!")
}

๐Ÿ’ก To request access to the microphone use the optional type parameter: ICanHas.capture(type: .audio) { ... }. See AVMediaType for other available types.

Photos (Library):

ICanHas.photos { authorized, status in
    print(authorized ? "You're authorized to access photos!" : "You're not authorized to access photos!")
}

Contacts:

ICanHas.contacts { authorized, status, error in
    print(authorized ? "You're authorized to access contacts!" : "You're not authorized to access contacts!")
}

๐Ÿ’ก You may optionally specify the address book reference you would like to use:

let addressBook = ABAddressBookCreateWithOptions(nil, nil)?.takeRetainedValue()
ICanHas.contacts(addressBook: addressBook) { ... }

License

ICanHas is available under the MIT license. See the LICENSE file for more info.

You might also like...
iOS 7+ Calendar (Date Picker) with Infinite Scrolling.
iOS 7+ Calendar (Date Picker) with Infinite Scrolling.

RSDayFlow iOS 7 Calendar with Infinite Scrolling. Only need 4 lines of code to set up. RSDayFlow is a slim fork of DayFlow with updates and extensions

An availability calendar implementation for iOS
An availability calendar implementation for iOS

NWCalendarView NWCalendar View is an iOS control that displays a calendar. It is perfect for appointment or availibilty selection. It allows for selec

A customizable calendar view for iOS.
A customizable calendar view for iOS.

JTCalendar JTCalendar is an easily customizable calendar control for iOS. Installation With CocoaPods, add this line to your Podfile. pod 'JTCalendar'

๐Ÿ“† An elegant calendar control for iOS.
๐Ÿ“† An elegant calendar control for iOS.

NO LONGER MAINTAINED Daysquare An elegant calendar control for iOS. Introduction Get bored with native silly UIDatePicker? You may have a try on this

A calendar control for iOS written in swift with mvvm pattern
A calendar control for iOS written in swift with mvvm pattern

ASCalendar try it on appetize Installation CocoaPods You can use CocoaPods to install ASCalendar by adding it to your Podfile: platform :ios, '8.0' us

An open source calendar framework for iOS, with support for customization, IBDesignable, Autolayout, and more.
An open source calendar framework for iOS, with support for customization, IBDesignable, Autolayout, and more.

About MBCalendarKit is a calendar control written in Objective-C with modern best practices and Swift interoperability in mind. It offers a flexible c

A fully customizable iOS calendar library, compatible with Objective-C and Swift
A fully customizable iOS calendar library, compatible with Objective-C and Swift

Table of contents Screenshots Installation Pre-knowledge Support Contact Screenshots iPhone iPad Safe Orientation Today Extension iOS8/9 iOS10 Interac

A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.
A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.

A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.

Anime Calendar's iOS App - Schedule your seasonal anime to watch!
Anime Calendar's iOS App - Schedule your seasonal anime to watch!

๐Ÿ“… Anime Calendar Anime Calendar's iOS App - Schedule your seasonal anime to watch! Currently in progress UI Uses Xibs and some programmatic views. De

Owner
Adolfo Rodriguez
Adolfo Rodriguez
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable

Q: How will my calendar dateCells look with this library? A: However you want them to look. More Images Features Range selection - select dates in a r

PatchTheCode 7.3k Jan 2, 2023
RCalendarPicker A date picker control, Calendar calendar control, select control, calendar, date selection, the clock selection control.

RCalendarPicker RCalendarPicker Calendar calendar control, select control, calendar, date selection, the clock selection control. ๆ—ฅๅŽ†ๆŽงไปถ ๏ผŒๆ—ฅๅŽ†้€‰ๆ‹ฉๆŽงไปถ๏ผŒๆ—ฅๅŽ†๏ผŒๆ—ฅๆœŸ้€‰ๆ‹ฉ

ๆœ่€€่พ‰ 131 Jul 18, 2022
A declarative, performant, iOS calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-featured calendar apps.

HorizonCalendar A declarative, performant, calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-feat

Airbnb 2.2k Jan 4, 2023
Simple customizable calendar component in Swift :calendar:

Koyomi Koyomi is a simple calendar view framework for iOS, written in Swift ?? Content Features Demo App Usage introduction : Change displayed month,

Shohei Yokoyama 741 Dec 24, 2022
Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events

Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events. It will gather events from your default iOS calendar.

Chase 194 Jan 4, 2023
Google Photos "takeout" doesn't retain created/modified dates of media.

GoogleTakeoutMediaDateCorrector Google Photos "takeout" doesn't retain created/modified dates of media. At least they do export this in a separate jso

Joshua Liebowitz 0 Dec 27, 2021
๐Ÿ“… Calendar for iOS, iPadOS and macOS in Swift

CalendarKit CalendarKit is a Swift calendar UI library for iOS, iPadOS and Mac Catalyst. It looks similar to the Apple Calendar app out-of-the-box, wh

Richard Topchii 2.2k Jan 5, 2023
An Easy to Use Calendar for iOS (Swift 5.0)

This is an easy to use, "just drag and drop it in your code" type of calendar for iOS. It supports both vertical and horizontal scrolling, as well as

Michael Michailidis 525 Dec 23, 2022
SwiftUI Simple Calendar / Date Picker for iOS

RKCalendar RKCalendar is a SwiftUI Calendar / Date Picker for iOS. Features include: minimum and maximum calendar dates selectable, single date select

null 453 Dec 28, 2022
A custom visual calendar for iOS 8+ written in Swift (>= 4.0).

Overview Screenshots GIF Demo Installation Usage Architecture Version matrix Advanced API For contributors Screenshots GIF Demo Installation CocoaPods

null 3.5k Dec 24, 2022