Skip to content

Commit 661263d

Browse files
committed
Updated for Swift 4 and Xcode 9
1 parent 6991c2c commit 661263d

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

PAPermissions/Classes/Checks/PACameraPermissionsCheck.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import UIKit
1111

1212
public class PACameraPermissionsCheck: PAPermissionsCheck {
1313

14-
var mediaType = AVMediaTypeVideo
14+
var mediaType = AVMediaType.video
1515

1616
public override func checkStatus() {
1717
let currentStatus = self.status
1818

1919
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
20-
let authStatus = AVCaptureDevice.authorizationStatus(forMediaType: mediaType)
20+
let authStatus = AVCaptureDevice.authorizationStatus(for: mediaType)
2121
switch authStatus {
2222

2323
case .authorized:
@@ -42,11 +42,11 @@ public class PACameraPermissionsCheck: PAPermissionsCheck {
4242
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
4343

4444
if #available(iOS 8.0, *) {
45-
let authStatus = AVCaptureDevice.authorizationStatus(forMediaType: mediaType)
45+
let authStatus = AVCaptureDevice.authorizationStatus(for: mediaType)
4646
if authStatus == .denied {
4747
self.openSettings()
4848
}else{
49-
AVCaptureDevice.requestAccess(forMediaType: mediaType, completionHandler: { (result) in
49+
AVCaptureDevice.requestAccess(for: mediaType, completionHandler: { (result) in
5050
if result {
5151
self.status = .enabled
5252
}else{

PAPermissions/Classes/Checks/PAMotionFitnessPermissionsCheck.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class PAMotionFitnessPermissionsCheck: PAPermissionsCheck {
3939

4040
self.status = motionActivity == nil ? .disabled : .enabled
4141

42-
if let e = error as? NSError {
42+
if let e = error as NSError? {
4343
if e.code == Int(CMErrorNotAuthorized.rawValue) {
4444
self.status = .denied
4545
self.openSettings()

PAPermissions/Classes/Checks/PANotificationsPermissionsCheck.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class PANotificationsPermissionsCheck: PAPermissionsCheck {
3333
self.types = [.badge, .sound, .alert]
3434
}
3535

36-
public override func checkStatus() {
36+
@objc public override func checkStatus() {
3737
let currentStatus = self.status
3838

3939
if #available(iOS 8.0, *) {

README.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ Right now it supports out of the box permissions for:
2222
![](./ReadmeResources/PAPermissions3.gif)
2323
## Compatibility
2424

25-
PAPermissions requires iOS8+, compatible with both Swift 3 and Objective-C based projects
25+
PAPermissions requires iOS8+, compatible with both Swift 4 and Objective-C based projects
2626

2727
If you are looking for the Swift 2 version of it, please check out the [legacy branch](https://github.com/pascalbros/PAPermissions/tree/legacy)
28-
28+
If you are looking for the Swift 3 version of it, please check out the [legacy branch](https://github.com/pascalbros/PAPermissions/tree/swift3)
2929
## Installation
3030

3131

@@ -45,17 +45,6 @@ Then, run the following command:
4545
$ pod install
4646
```
4747

48-
### Carthage
49-
50-
Add this to Cartfile
51-
```sh
52-
github "ReactiveX/RxSwift" "3.0.0-beta.1"
53-
```
54-
55-
```sh
56-
$ carthage update
57-
```
58-
5948
### Manual Installation
6049

6150
Just copy the PAPermissions folder in your project

0 commit comments

Comments
 (0)