diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 17b0d327..8e2d91c8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,5 +3,5 @@ ## Checklist -- [ ] Testing in compability platforms -- [ ] Installed correct via Swift Package Manager and Cocoapods +- [] Testing in compability platforms +- [] Installed correct via `Swift Package Manager` and `Cocoapods` diff --git a/Assets/Sketch/sppermissions-v6-code-draw.pcvd b/Assets/Sketch/sppermissions-v6-code-draw.pcvd deleted file mode 100644 index 456d692d..00000000 Binary files a/Assets/Sketch/sppermissions-v6-code-draw.pcvd and /dev/null differ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ffa222be..28ecab0e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/Example Apps/SPPermissions.xcodeproj/project.pbxproj b/Example Apps/SPPermissions.xcodeproj/project.pbxproj index 8587731d..3252a777 100644 --- a/Example Apps/SPPermissions.xcodeproj/project.pbxproj +++ b/Example Apps/SPPermissions.xcodeproj/project.pbxproj @@ -136,7 +136,7 @@ children = ( F4C77E9E266D5A16001D5870 /* iOS Example.entitlements */, F471BDC8264A5B5F000693BC /* App */, - F471BDFC264A629A000693BC /* Data */, + F471BDFC264A629A000693BC /* Recources */, F471BDFB264A6291000693BC /* Scenes */, F42F10C326524EA400D5B314 /* Localization */, F471BDC4264A5995000693BC /* Info.plist */, @@ -169,12 +169,12 @@ path = Scenes; sourceTree = ""; }; - F471BDFC264A629A000693BC /* Data */ = { + F471BDFC264A629A000693BC /* Recources */ = { isa = PBXGroup; children = ( F471BDBF264A5995000693BC /* Assets.xcassets */, ); - path = Data; + path = Recources; sourceTree = ""; }; F47CBAF82651826100A8A00F /* tvOS Example */ = { diff --git a/Example Apps/SPPermissions.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example Apps/SPPermissions.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index c5b2fe62..f9276d55 100644 --- a/Example Apps/SPPermissions.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Example Apps/SPPermissions.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,7 +6,7 @@ "repositoryURL": "https://github.com/ivanvorobei/SparrowKit", "state": { "branch": "main", - "revision": "d1a2d489417f98620558da08ddcf44a9d53e58f3", + "revision": "be8adcf0d1f91f04eed460faee78852d15d75acc", "version": null } } diff --git a/Example Apps/SPPermissions.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate b/Example Apps/SPPermissions.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate index 507a1bac..fc88f93d 100644 Binary files a/Example Apps/SPPermissions.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate and b/Example Apps/SPPermissions.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Example Apps/SPPermissions.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme b/Example Apps/SPPermissions.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme index 89ba6c72..aa2f23c4 100644 --- a/Example Apps/SPPermissions.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme +++ b/Example Apps/SPPermissions.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme @@ -34,6 +34,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "en" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/Icon.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/Icon.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/Icon.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/Icon.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_20pt.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_20pt.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_20pt.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_20pt.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_29pt.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_29pt.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_29pt.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_29pt.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_40pt.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_40pt.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_40pt.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_40pt.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_76pt.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_76pt.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_76pt.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_76pt.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png b/Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png rename to Example Apps/iOS Example/Recources/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png diff --git a/Example Apps/iOS Example/Data/Assets.xcassets/Contents.json b/Example Apps/iOS Example/Recources/Assets.xcassets/Contents.json similarity index 100% rename from Example Apps/iOS Example/Data/Assets.xcassets/Contents.json rename to Example Apps/iOS Example/Recources/Assets.xcassets/Contents.json diff --git a/README.md b/README.md index 6cb90e63..0b42a2b6 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,14 @@ # SPPermissions - - -### 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 ★`
Check out my other libraries: - -

- - - +

+ + +

-### 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

@@ -47,8 +39,8 @@ If you like the project, don't forget to `put star ★`
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) @@ -60,9 +52,7 @@ If you like the project, don't forget to `put star ★`
Check out my other li ## Installation - - -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 @@ -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' @@ -94,7 +84,7 @@ pod 'SPPermissions/LocationAlways' pod 'SPPermissions/Microphone' ``` -

Available subspecs +
Subspecs

```ruby @@ -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 @@ -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" @@ -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" @@ -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 { @@ -308,11 +299,9 @@ extension Controller: SPPermissionsDataSource { } ``` - - ### 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() @@ -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 @@ -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 @@ -421,17 +410,8 @@ Also changed title for button. Instead of `allow` now using `continue`. The App ## Russian Community -Подписывайся в телеграм-канал, если хочешь получать уведомления о новых туториалах.
-Со сложными и непонятными задачами помогут в чате. - -

- - - - - - -

+Я веду [телеграм канал](https://sparrowcode.by/telegram), там публикую новости и туториалы. +С проблемой помогут [в нашем чате](https://sparrowcode.by/telegram/chat). Видео-туториалы выклыдываю на [YouTube](https://ivanvorobei.by/youtube): diff --git a/SPPermissions.podspec b/SPPermissions.podspec index b146197c..d45bf4ff 100644 --- a/SPPermissions.podspec +++ b/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" }