Skip to content

Commit

Permalink
Merge pull request #274 from ivanvorobei/dev7
Browse files Browse the repository at this point in the history
Dev7
  • Loading branch information
ivanvorobei committed Dec 13, 2021
2 parents 7da0e1f + d5b51f1 commit df2d09f
Show file tree
Hide file tree
Showing 29 changed files with 41 additions and 57 deletions.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -3,5 +3,5 @@

## Checklist
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
- [ ] Testing in compability platforms
- [ ] Installed correct via Swift Package Manager and Cocoapods
- [] Testing in compability platforms
- [] Installed correct via `Swift Package Manager` and `Cocoapods`
Binary file removed Assets/Sketch/sppermissions-v6-code-draw.pcvd
Binary file not shown.
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Expand Up @@ -23,8 +23,11 @@ Here you find all which using in project:
- // MARK: - Init
- // MARK: - Lifecycle
- // MARK: - Layout
- // MARK: - Internal
- // MARK: - Public
- // MARK: - Private
- // MARK: - Internal
- // MARK: - Models
- // MARK: - Ovveride

If you can't find valid, add new to codestyle agreements please. Other can be use if class is large and need struct it even without adding to codestyle agreements.

Expand Down
6 changes: 3 additions & 3 deletions Example Apps/SPPermissions.xcodeproj/project.pbxproj
Expand Up @@ -136,7 +136,7 @@
children = (
F4C77E9E266D5A16001D5870 /* iOS Example.entitlements */,
F471BDC8264A5B5F000693BC /* App */,
F471BDFC264A629A000693BC /* Data */,
F471BDFC264A629A000693BC /* Recources */,
F471BDFB264A6291000693BC /* Scenes */,
F42F10C326524EA400D5B314 /* Localization */,
F471BDC4264A5995000693BC /* Info.plist */,
Expand Down Expand Up @@ -169,12 +169,12 @@
path = Scenes;
sourceTree = "<group>";
};
F471BDFC264A629A000693BC /* Data */ = {
F471BDFC264A629A000693BC /* Recources */ = {
isa = PBXGroup;
children = (
F471BDBF264A5995000693BC /* Assets.xcassets */,
);
path = Data;
path = Recources;
sourceTree = "<group>";
};
F47CBAF82651826100A8A00F /* tvOS Example */ = {
Expand Down
Expand Up @@ -6,7 +6,7 @@
"repositoryURL": "https://github.com/ivanvorobei/SparrowKit",
"state": {
"branch": "main",
"revision": "d1a2d489417f98620558da08ddcf44a9d53e58f3",
"revision": "be8adcf0d1f91f04eed460faee78852d15d75acc",
"version": null
}
}
Expand Down
Binary file not shown.
Expand Up @@ -34,6 +34,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = "en"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
76 changes: 28 additions & 48 deletions README.md
@@ -1,22 +1,14 @@
# SPPermissions

<img align="left" src="https://cdn.ivanvorobei.by/github/sppermissions/preview-v6.2.0.jpg" width="420"/>

### About

Improve the user flow when asking permissions. You can also check state of permissions, available are: `.authorized`, `.denied` & `.notDetermined`.

The library has three ready-use controllers: list, dialog & native. Supports iPad, dark mode, and localizations. To get going with using the library, see [Quick Start](#quick-start).

If you like the project, don't forget to `put star ★`<br>Check out my other libraries:

<p float="left">
<a href="https://opensource.ivanvorobei.by">
<img src="https://github.com/ivanvorobei/Readme/blob/main/Buttons/more-libraries.svg">
</a>
<p aligment="left">
<img src="https://cdn.ivanvorobei.by/github/sppermissions/v7/table-style.png?version=2" height="290"/>
<img src="https://cdn.ivanvorobei.by/github/sppermissions/v7/dialog-style.png?version=2" height="290"/>
<img src="https://cdn.ivanvorobei.by/github/sppermissions/v7/native-style.png?version=2" height="290"/>
</p>

### Permissions
Availalbe three ready-use interface - list, dialog & native. Supports iPad, dark mode, and localizations. Also you can check state of permissions, available are: `.authorized`, `.denied` & `.notDetermined`.

### Supported Permissions

<p float="left">
<img src="https://cdn.ivanvorobei.by/github/sppermissions/permissions/camera.png" width="38">
Expand Down Expand Up @@ -47,8 +39,8 @@ If you like the project, don't forget to `put star ★`<br>Check out my other li
- [Quick Start](#quick-start)
- [Status](#status)
- [Request](#request)
- [Dialog](#dialog)
- [List](#list)
- [Dialog](#dialog)
- [Native](#native)
- [DataSource](#datasource)
- [Denied alert](#denied-alert)
Expand All @@ -60,9 +52,7 @@ If you like the project, don't forget to `put star ★`<br>Check out my other li

## Installation

<img align="right" src="https://cdn.ivanvorobei.by/github/sppermissions/spm-install-preview.png" width="490"/>

SPPermisions is ready to use on iOS 11+, and supports iOS, tvOS, and SwiftUI. `SPPermissions` works with Swift 5+, and requires Xcode 12.0 or higher.
SPPermisions is ready to use on iOS 11+, and supports iOS, tvOS, and SwiftUI.

### Swift Package Manager

Expand All @@ -80,7 +70,7 @@ Next choose the permissions you need. But don't add all of them, because apple w

### CocoaPods:

[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate `SPPermissions` using CocoaPods, specify it in your `Podfile`:
[CocoaPods](https://cocoapods.org) is a dependency manager. For usage and installation instructions, visit their website. To integrate `SPPermissions` using CocoaPods, specify it in your `Podfile`:

```ruby
pod 'SPPermissions/Notification'
Expand All @@ -94,7 +84,7 @@ pod 'SPPermissions/LocationAlways'
pod 'SPPermissions/Microphone'
```

<details><summary>Available subspecs</summary>
<details><summary>Subspecs</summary>
<p>

```ruby
Expand Down Expand Up @@ -166,13 +156,14 @@ import SPPermissionsCamera
import SPPermissionsPhotoLibrary
```

It's required because library split to modules. After importing you'll see available permissions by typing `SPPermissions.Permission.camera` for example.
If you install via [CocoaPods](#cocoapods), you only need to import one class:

```swift
import SPPermissions
```

Its required because library split to modules. After importing you'll see available permissions by typing `SPPermissions.Permission.camera` for example.
All other installed classes imported automatically.

## Quick Start

Expand Down Expand Up @@ -211,20 +202,20 @@ To check the state of any permission, call `SPPermissions.Permission`:
let authorized = SPPermissions.Permission.calendar.authorized
```

Also available are status for: `denied` & `notDetermined`.
Also available are status for `denied` & `notDetermined`.

## Request

`SPPermissions` has three presentation styles: `Dialog`, `List` and `Native`. Each interface has delegates and a data source. If you want see an example app, open `Example Apps/SPPermissions.xcodeproj`.

### Dialog
### List

This is a modal alert. I recommend using this alert style when you have less than three requested permissions. Usage example:
Native `UITableViewController`. Use it when you have more than two permissions. An example of how it is used:

```swift
let controller = SPPermissions.dialog([.camera, .photoLibrary])
let controller = SPPermissions.list([.calendar, .camera, .contacts])

// Override texts in controller
// Ovveride texts in controller
controller.titleText = "Title Text"
controller.headerText = "Header Text"
controller.footerText = "Footer Text"
Expand All @@ -244,14 +235,14 @@ controller.dismissCondition = .allPermissionsDeterminated
controller.present(on: self)
```

### List
### Dialog

Native `UITableViewController` with support for the iPad. Use it when you have more than two permissions. An example of how it is used:
This is a modal alert. I recommend using this alert style when you have less than three requested permissions. Usage example:

```swift
let controller = SPPermissions.list([.calendar, .camera, .contacts])
let controller = SPPermissions.dialog([.camera, .photoLibrary])

// Ovveride texts in controller
// Override texts in controller
controller.titleText = "Title Text"
controller.headerText = "Header Text"
controller.footerText = "Footer Text"
Expand Down Expand Up @@ -287,7 +278,7 @@ controller.present(on: self)

## DataSource

For data source using protocol `SPPermissionsDataSource`. You can customize the permission cells / provide denied alert texts.
For data source using protocol `SPPermissionsDataSource`. You can customize the permission cells and provide denied alert texts.

```swift
extension Controller: SPPermissionsDataSource {
Expand All @@ -308,11 +299,9 @@ extension Controller: SPPermissionsDataSource {
}
```

<img align="left" src="https://cdn.ivanvorobei.by/github/sppermissions/preview-denied-alert.png" width="320"/>

### Denied alert

If a permission is denied, you can provide an alert to the user with an option to open settings. An example of how you can customise the alert text:
If a permission is denied, you can provide [an alert](https://cdn.ivanvorobei.by/github/sppermissions/v7/preview-denied-alert.png) to the user with an option to open settings. An example of how you can customise the alert text:

```swift
let texts = SPPermissionsDeniedAlertTexts()
Expand Down Expand Up @@ -365,7 +354,7 @@ extension Controller: SPPermissionsDelegate {
- Italian `it`
- Chinese Traditional `zh_Hant`

If you want to add more, please, create folder `language_id.lproj` and make a pull request. If you want to use your custom strings, check the [DataSource](#datasource) section.
If you want to add more, please, create folder `[language_id].lproj` and make a pull request. If you want to use your custom strings, check the [DataSource](#datasource) section.

## Keys in Info.plist

Expand Down Expand Up @@ -407,7 +396,7 @@ If you use xliff localization export, keys will be create automatically. If you

## Apple Review

Apple changed its review guidelines in May/June 2021. When requesting permissions, apps should require users to always request and make a decision whether to allow or decline the permission. For this reason, the close button in `SPPermissions` is hidden by default. If you want to force show the close button, run the following code:
Apple changed its review guidelines in June 2021. When requesting permissions, apps should require users to always request and make a decision whether to allow or decline the permission. For this reason, the close button in `SPPermissions` is hidden by default. If you want to force show the close button, run the following code:

```swift
// Show & hide close button
Expand All @@ -421,17 +410,8 @@ Also changed title for button. Instead of `allow` now using `continue`. The App

## Russian Community

Подписывайся в телеграм-канал, если хочешь получать уведомления о новых туториалах.<br>
Со сложными и непонятными задачами помогут в чате.

<p float="left">
<a href="https://sparrowcode.by/telegram">
<img src="https://github.com/ivanvorobei/Readme/blob/main/Buttons/open-telegram-channel.svg">
</a>
<a href="https://sparrowcode.by/telegram/chat">
<img src="https://github.com/ivanvorobei/Readme/blob/main/Buttons/russian-community-chat.svg">
</a>
</p>
Я веду [телеграм канал](https://sparrowcode.by/telegram), там публикую новости и туториалы.
С проблемой помогут [в нашем чате](https://sparrowcode.by/telegram/chat).

Видео-туториалы выклыдываю на [YouTube](https://ivanvorobei.by/youtube):

Expand Down
4 changes: 2 additions & 2 deletions SPPermissions.podspec
@@ -1,8 +1,8 @@
Pod::Spec.new do |s|

s.name = "SPPermissions"
s.version = "6.8.4"
s.summary = "Ask permissions on Swift. Available List, Dialog & Native interface. Can check state permission."
s.version = "7.0.0"
s.summary = "Ask permissions on Swift. Available List, Dialog & Native interface. Can check state permission. Support SwiftUI."
s.homepage = "https://github.com/ivanvorobei/SPPermissions"
s.source = { :git => "https://github.com/ivanvorobei/SPPermissions.git", :tag => s.version }
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down

0 comments on commit df2d09f

Please sign in to comment.