A SwiftUI package to beautifully display and handle permissions.

Overview


PermissionsSwiftUI: A SwiftUI package to handle permissions

PermissionsSwiftUI displays and handles permissions in SwiftUI. It is largely inspired by SPPermissions. The UI is highly customizable and resembles an Apple style. If you like the project, please star ★.

PermissionsSwiftUI looks equally gorgeous on both ☀️ light and 🌑 dark mode.

🧭 Navigation

Usage
Additional Information

🖥️ Installation

Requirements

  • iOS 11 (SwiftUI require iOS 13.0) or iPadOS 13
  • Xcode 12 and Swift 5.3
  • tvOS support coming soon
  • No MacOS, and WatchOS support for now

Install

Swift Package Manager (Recommended)

You can install PermissionsSwiftUI into your Xcode project via SPM. To learn more about SPM, click here

  1. In Xcode 12, open your project and navigate to FileSwift PackagesAdd Package Dependency...

For Xcode 13, navigate to FilesAdd Package

  1. Paste the repository URL (https://github.com/jevonmao/PermissionsSwiftUI) and click Next.
  2. For Version, verify it's Up to next major.
  3. Click Next and ONLY SELECT PERMISSIONS NEEDED else Apple will reject your app

(You don't need to add CorePermissionsSwiftUI or PermissionsSwiftUI)

image

  1. Click Finish
  2. You are all set, thank you for using PermissionsSwiftUI!

Cocoapods (Deprecated)

You can also install PermissionsSwiftUI with Cocoapods. Add pod 'PermissionsSwiftUI' in your podfile:

platform :ios, '14.0'

target 'test abstract' do
  use_frameworks!
  pod 'PermissionsSwiftUI'

end

🚀 Quickstart

Before you start, please star ★ this repository. Your star is my biggest motivation to pull all-nighters and maintain this open source project.

⚠️ v1.4.0 Migration Guide

v1.4 is here! If you encounter any issues, please checkout the migration guide designed to help developers resolve any deprecations and API updates.

Modal Style

To use PermissionsSwiftUI, simply add the JMModal modifier to any view:

.JMModal(showModal: $showModal, for: [.locationAlways, .photo, .microphone])`

Pass in a Binding to show the modal view, and add whatever permissions you want to show. For example:

   struct ContentView: View {
       @State var showModal = false
       var body: some View {
           Button(action: {
               showModal=true
           }, label: {
               Text("Ask user for permissions")
           })
           .JMModal(showModal: $showModal, for: [.locationAlways, .photo, .microphone])
       }
   }

Alert Style

The alert style is equally gorgeous, and allows for more versatile use. It is recommended when you have less than 3 permissions.
To show a permission pop up alert, use:
.JMAlert(showModal: $showModal, for: [.locationAlways, .photo])

Similar to the previous JMPermissions, you need to pass in a Binding to show the view, and add whatever permissions you want to show. To quickly glance all of PermissionsSwiftUI's customization and configurations, checkout the cheatsheet!





🛠️ Usage

Customize Permission Texts

To customize permission texts, use the modifier setPermissionComponent() For example, you can change title, description, and image icon:

.setPermissionComponent(for: .camera, 
                        image: AnyView(Image(systemName: "camera.fill")), 
                        title: "Camcorder",
                        description: "App needs to record videos")

and the result:


Or only change 1 of title and description:
setPermissionComponent(for: .tracking, title: "Trackers")
setPermissionComponent(for: .tracking, description: "Tracking description")

Note:

  • The parameters you don't provide will show the default text
  • Add the setPermissionComponent modifier on your root level view, after JMPermissions modifier

The image parameter accepts AnyView, so feel free to use SF Symbols or your custom asset:

.setPermissionComponent(for: .camera, 
                        image: AnyView(Image("Your-cool-image"))

Even full SwiftUI views will work 😱 :

.setPermissionComponent(for: .camera, 
                        image: AnyView(YourCoolView())

You can use custom text and icon for all the supported permissions, with a single line of code.

Customize Header Texts

To customize the header title, use the modifier changeHeaderTo: Annotated for headers screen

.JMPermissions(showModal: $showModal, for: [.camera, .location, .calendar])
.changeHeaderTo("App Permissions")

To customize the header description, use the modifier changeHeaderDescriptionTo:

.JMPermissions(showModal: $showModal, for: [.camera, .location, .photo])
.changeHeaderDescriptionTo("Instagram need certain permissions in order for all the features to work.")

To customize the bottom description, use the modifier changeBottomDescriptionTo:

.JMPermissions(showModal: $showModal, for: [.camera, .location, .photo])
.changeBottomDescriptionTo("If not allowed, you have to enable permissions in settings")

onAppear and onDisappear Override

You might find it incredibly useful to execute your code, or perform some update action when a PermissionsSwiftUI view appears and disappears.
You can perform some action when PermissionsSwiftUI view appears or disappears by:

.JMPermissions(showModal: $showModal, for: [.locationAlways, .photo, .microphone], onAppear: {}, onDisappear: {})

The onAppear and onDisappear closure parameters will be executed everytime PermissionsSwiftUI view appears and disappears.
The same view modifier closure for state changes are available for the JMAlert modifier:

.JMAlert(showModal: $showModal,
                     for: [.locationAlways, .photo],
                     onAppear: {print("Appeared")},
                     onDisappear: {print("Disappeared")})

Auto Check Authorization

PermissionsSwiftUI by default will automatically check for authorization status. It will only show permissions that are currently notDetermined status. (iOS system prevent developers from asking denied permissions. Allowed permissions will also be ignored by PermissionsSwiftUI). If all permissions are allowed or denied, PermissionsSwiftUI will not show the modal or alert at all. To set auto check authorization, use the autoCheckAuthorization parameter:

.JMModal(showModal: $showModal, for: [.camera], autoCheckAuthorization: false)

same applies for JMAlert

.JMAlert(showModal: $showModal, for: [.camera], autoCheckAuthorization: false)

Auto Dismiss

PermissionsSwiftUI by default will not have any auto dimiss behavior. You can override this behaviour to make it automatically dismiss the modal or alert after user allows the last permission item. (All permissions must be ALLOWED, if any is DENIED, it will not auto dismiss).

.JMModal(... autoDismiss: Bool) -> some View

Pass in true or false to select whether to automatically dismiss the view.

Customize Colors

Using PermissionSwiftUI's capabilities, developers and designers can customize all the UI colors with incredible flexibility. You can fully configure all color at all states with your custom colors.
To easily change the accent color:

.setAccentColor(to: Color(.sRGB, red: 56/255, green: 173/255,
                                  blue: 169/255, opacity: 1))

To change the primary (default Apple blue) and tertiary (default Apple red) colors:

.setAccentColor(toPrimary: Color(.sRGB, red: 56/255, green: 173/255,
                                  blue: 169/255, opacity: 1),
                toTertiary: Color(.systemPink))

⚠️ .setAccentColor() and .setAllowButtonColor() should never be used at the same time.

To unleash the full customization of all button colors under all states, you need to pass in the AllButtonColors struct:

.setAllowButtonColor(to: .init(buttonIdle: ButtonColor(foregroundColor: Color,
                                                               backgroundColor: Color),
                                       buttonAllowed: ButtonColor(foregroundColor: Color,
                                                                  backgroundColor: Color),
                                       buttonDenied: ButtonColor(foregroundColor: Color,
                                                                 backgroundColor: Color)))

For more information regarding the above method, reference the official documentation.

Restrict Dismissal

PermissionsSwiftUI will by default, prevent the user from dismissing the modal and alert, before all permissions have been interacted. This means if the user has not explictly denied or allowed EVERY permission shown, they will not be able to dismiss the PermissionsSwiftUI view. This restrict dismissal behavior can be overriden by the var restrictModalDismissal: Bool or var restrictAlertDismissal: Bool properties. To disable the default restrict dismiss behavior:

.JMModal(showModal: $show, for permissions: [.camera], restrictDismissal: false)

You can also configure with the model:

let model: PermissionStore = {
        var model = PermissionStore()
        model.permissions = [.camera]
        model.restrictModalDismissal = false
        model.restrictAlertDismissal = false
        return model
    }
    ......

    .JMModal(showModal: $showModal, forModel: model)

Configuring Health Permissions

Unlike all the other permissions, the configuration for health permission is a little different. Because Apple require developers to explictly set read and write types, PermissionsSwiftUI greatly simplifies the process.

HKAccess

The structure HKAccess is required when initalizing health permission’s enum associated values. It encapsulates the read and write type permissions for the health permission.

To set read and write health types (activeEnergyBurned is used as example here):

let healthTypes = Set([HKSampleType.quantityType(forIdentifier: .activeEnergyBurned)!])
.JMModal(showModal: $show, for: [.health(categories: .init(readAndWrite: healthTypes))])

//Same exact syntax for JMAlert styles
.JMAlert(showModal: $show, for: [.health(categories: .init(readAndWrite: healthTypes))])

To set read or write individually:

let readTypes = Set([HKSampleType.quantityType(forIdentifier: .activeEnergyBurned)!])
let writeTypes = Set([HKSampleType.quantityType(forIdentifier: .appleStandTime)!])
.JMModal(showModal: $showModal, for: [.health(categories: .init(read: readTypes, write: writeTypes))])

You may also set only read or write type:

let readTypes = Set([HKSampleType.quantityType(forIdentifier: .activeEnergyBurned)!])
.JMModal(showModal: $showModal, for: [.health(categories: .init(read: readTypes))])

📖 Cheatsheat

Modifiers

Customize overall accent color:

setAccentColor(to:)
setAccentColor(toPrimary:toTertiary:)

Customize title:

changeHeaderTo(_:)

Customize top description:

changeHeaderDescriptionTo(_:)

Customize bottom description:

changeBottomDescriptionTo(_:)

Customize each permission's displayed text & image:

setPermissionComponent(for:image:title:description:)

setPermissionComponent(for:title:)

setPermissionComponent(for:description:)

Customize allow button's colors:

setAllowButtonColor(to:)

Automatically dismiss after last

autoDismiss: Bool

Parameters of JMModal and JMAlert

Check authorization before showing modal or alert

autoCheckAuthorization: Bool

Prevent dismissing before all permissions interacted

restrictDismissal: Bool

Do something right before view appear

onAppear: () -> Void

Do something right before view disappear

onDisappear: (() -> Void

🧰 Supported Permissions

Here is a list of all the permissions PermissionsSwiftUI supports. Yup, even the newest tracking permission for iOS 14 so you can stay on top of your game. All permissions in PermissionsSwiftUI come with a default name, description, and a stunning Apple native SF Symbols icon.

Support for FaceID permission is work in progress and coming soon! If you don't find a permission you need, open an issue. Even better, build it yourself and open a pull request, you can follow this step-by-step guide on adding new permissions.


A card of all the permissions

💪 Contribute

Contributions are welcome here for coders and non-coders alike. No matter what your skill level is, you can for certain contribute to PermissionSwiftUI's open source community. Please read contributing.md before starting, and if you are looking to contributing a new type of iOS permission, be sure to read this step-by-step guide.

If you encounter ANY issue, have ANY concerns, or ANY comments, please do NOT hesitate to let me know. Open a discussion, issue, or email me. As a developer, I feel you when you don't understand something in the codebase. I try to comment and document as best as I can, but if you happen to encounter any issues, I will be happy to assist in any way I can.

Additional Information

Acknowledgement

SPPermissions is in large a SwiftUI remake of famous Swift library SPPermissions by @verabeis. SPPermissions was initially created in 2017, and today on GitHub has over 4000 stars. PermissionsSwiftUI aims to deliver a just as beautiful and powerful library in SwiftUI. If you star ★ my project PermissionsSwiftUI, be sure to checkout the original project SPPermissions where I borrowed the UI Design, some parts of README.md page, and important source code references along the way.

License

PermissionsSwiftUI is created by Jingwen (Jevon) Mao and licensed under the MIT License

Comments
  • [BUG] - On click of Allow push notifications fails

    [BUG] - On click of Allow push notifications fails

    Hi, I've set up my iOS app to ask for permissions like so: .JMModal(showModal: self.$showModal, for: [.locationAlways, .notification]) Allowing location successfully changes button to allowed, but allowing push notifications does not change the button to allowed, therefore, I cannot exit the modal.

    However, I do see printouts in my appDelegate's didRegisterForRemoteNotificationsWithDeviceToken: saying that I have successfully registered? Everytime I click allow I see the button. I only see the Apple alert for allowing push notifications the very first time. But, button does not change to allowed.

    To Reproduce Steps to reproduce the behavior:

    1. Show JMModal with .locationAlways and .notification
    2. Allow Notifications
    3. See error

    push notifications should change button to allowed and be able to dismiss.

    Desktop (please complete the following information):

    • OS: iOS
    • Version 1.4

    Smartphone (please complete the following information):

    • Device: iPhone 12 Pro device

    Additional context Add any other context about the problem here.

    help wanted confirmed bug 
    opened by smaldd14 12
  • Translation for Allow-Button

    Translation for Allow-Button

    Is your feature request related to a problem? Please describe. I know the word Allow is pretty self-explanatory in all languages. But, is there any possibility to change/translate this? I don't see any method for that. Thanks for the help!

    enhancement good first issue work in progres 
    opened by delvinwidjaja 11
  • [Action] - Permission submodules to avoid info.plist App Store rejection

    [Action] - Permission submodules to avoid info.plist App Store rejection

    Currently PermissionsSwiftUI uses one whole module for all the permissions, resulting in App Store rejection when used. Apple guidelines would require info.plist strings for all permissions referenced in code.

    Tracking bug #77.

    Action items

    • [x] Define submodules in Package.swift
    • [x] Create new directories and move permission managers files accordingly
    • [x] Build & Test, pull request

    (This solution is derived from https://github.com/ivanvorobei/SPPermissions/issues/240)

    Visual Reference

    Apple rejection reason (original text):

    ITMS-90683: Missing Purpose String in Info.plist - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSContactsUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data are required to include a purpose string. If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more

    Special Instructions

    help wanted good first issue work in progres 
    opened by jevonmao 9
  • [BUG] - JMNotificationPermissionManager does not work with iOS 15

    [BUG] - JMNotificationPermissionManager does not work with iOS 15

    Describe the bug I was building my project with iOS 15 and the library won't build. Starting from iOS 15, UIApplication.shared.registerForRemoteNotifications() cannot be used in extensions anymore and the error suggests to use a ViewController implementation instead.

    To Reproduce Steps to reproduce the behavior:

    1. Install Xcode 13
    2. Build the project
    3. Observe the build process fail

    Expected behavior The framework should build

    Smartphone (please complete the following information):

    • OS: iOS 15
    possible bug stale 
    opened by cipolleschi 6
  • prevent dismiss modal before allowing all permissions

    prevent dismiss modal before allowing all permissions

    Describe the solution you'd like A clear and concise description of what you want to happen.

    I need to prevent user from dismissing modal view before allowing all permissions.

    enhancement good first issue 
    opened by gharary 6
  • Add ability to customize accent colour

    Add ability to customize accent colour

    The default colour is blue for PermissionsSwiftUI, which doesn't quite work with my app's design.

    For the permission images, I can pass in custom images and provide them with my preferred accent colour.

    For the buttons, there seems to be no way to customize them. I see in the source code "ButtonStatusColor", but as it's not a public class I cannot extend it and over-ride it.

    Being able to pass in an accent colour that when calling .JMModal would be great!

    enhancement good first issue 
    opened by khuffie 6
  • Use generics to replace AnyView

    Use generics to replace AnyView

    Using AnyView is bad practice, and if it can be replaced (and I believe it can in this case) it should be. With just a few changes, MainView.swift would be modified to look like this:

    struct MainView<BodyView: View>: View {
        private var showModal: Binding<Bool>
        private var bodyView: BodyView
        init(for bodyView: BodyView, show showModal: Binding<Bool>) {
            self.bodyView = bodyView
            self.showModal = showModal
        }
    
        var body: some View {
            bodyView
                .sheet(isPresented: showModal, content: {
                    ModalView(showModal: showModal)
                })
                
        }
    }
    

    AnyView is used in many places and most (if not all) of them can be replaced with generics. This won't break anyone's existing code either, the type will not be MainView, it will be MainView<AnyView>. AnyView should be switched for generics in JMPermission (for the imageIcon) as well. This helps SwiftUI update views more efficiently and prevents always casting the image to AnyView like is currently in the README:

    .setPermissionComponent(for: .camera, 
                            image: AnyView(Image(systemName: "camera.fill")), 
                            title: "Camcorder",
                            description: "App needs to record videos")
    
    enhancement wontfix 
    opened by johnnythedoggie 6
  • [BUG] - Trying to ask for tracking permissions with iOS < 14.5 will cause crash

    [BUG] - Trying to ask for tracking permissions with iOS < 14.5 will cause crash

    Describe the bug If you are not using iOS v14.5, the handlePermissionRequest() permission.getPermissionManager()?.init(permissionType: permission) will return nil because version is less than 14.5... This should be correct behavior, however, the next line in handlePermissionRequest() tries to force unwrap permissionManager by doing permissionManager!.requestPermission...

    Would a if permissionManager != nil {} check be enough to suffice?

    To Reproduce Steps to reproduce the behavior:

    1. use iOS simulator with v14.4, add .tracking to JMModal, watch crash

    Expected behavior Should not crash with iOS versions < 14.5... Should just not show tracking permission option

    confirmed bug 
    opened by smaldd14 5
  • Unsafe Flags - Can't build any longer

    Unsafe Flags - Can't build any longer

    Describe the bug Here is the alert I get when trying to build: The package product 'PermissionsSwiftUI' cannot be used as a dependency of this target because it uses unsafe build flags. This happens when updating to versions 1.4.0 or 1.4.1. Version 1.3.0 still builds.

    To Reproduce Steps to reproduce the behavior: Just build & run

    Expected behavior A clear and concise description of what you expected to happen.

    Screenshots If applicable, add screenshots to help explain your problem.

    Desktop (please complete the following information):

    • OS: [iOS 14]

    Additional context Add any other context about the problem here.

    possible bug confirmed bug 
    opened by macteuts 5
  • [BUG] - Modal only gets triggered once on app install

    [BUG] - Modal only gets triggered once on app install

    Describe the bug Modal only gets triggered once when the app is installed

    To Reproduce Steps to reproduce the behavior: After the user gives permission to the app, the user can revoke the permission manually in settings. Apparently, the new state of the permissions given can't be detected. When I try to show the modal by observing the permission value it shows nothing.

    Smartphone (please complete the following information):

    • Device: iPhone XR
    • OS: 15.5

    Additional context I'm not really sure if this is a bug or if this is just not implemented (yet).

    help wanted stale 
    opened by delvinwidjaja 4
  • Route to App Settings

    Route to App Settings

    Is your feature request related to a problem? Please describe. As of right now, if the user denies a permission, the button just shows denied.

    Describe the solution you'd like If any permissions have been denied at all for an alert or model, have some easy way for the user to route to the apps settings for them to change.

    Describe alternatives you've considered Not really other than trying to add this feature in myself. I believe the easier you make things on a user the longer they will stick around. This would be a small pain point if the user accidentally denies a permission and has no very easy way to turn it back on.

    feature request stale 
    opened by drewg233 4
  • [BUG] - iOS 15, dismissal is not working, if the showModal toggles within onAppear function of the view.

    [BUG] - iOS 15, dismissal is not working, if the showModal toggles within onAppear function of the view.

    Describe the bug A clear and concise description of what the bug is.

    This bug only present on iOS 15. When, the showModal boolean is set to true in .onAppear. It is not possible to dismiss the modal, unless restrictDismissal is set to false. To Reproduce Steps to reproduce the behavior: Great example would be:

    struct Dashboard: View {
       @State private var showModal: Bool = false
       var body: Some View {
              VStack {
                 //some code
       }.onAppear {
             showModal = true
        }
    }
    

    Expected behavior A clear and concise description of what you expected to happen. Modal with permissions will disappear when the "close" button is pressed

    Screenshots If applicable, add screenshots to help explain your problem. Attached GIF recording of the issue ios15BUG *Desktop (please complete the following information):

    • OS: iOS 15
    • Browser [e.g. chrome, safari]
    • Version [e.g. 22]

    Smartphone (please complete the following information):

    • Device: [e.g. iPhone6]
    • OS: [e.g. iOS8.1]
    • Browser [e.g. stock browser, safari]
    • Version [e.g. 22]

    Additional context Add any other context about the problem here. The issue is present in the simulator and in the physical device.

    help wanted good first issue confirmed bug 
    opened by sapoepsilon 7
Releases(1.5.6)
  • 1.5.6(May 14, 2022)

  • 1.5.5(May 13, 2022)

    What's New? ✨

    • Added localizations
    • Added Danish, Italian, Finnish localization by @delvinwidjaja in https://github.com/jevonmao/PermissionsSwiftUI/pull/110
    • Add german(de_DE) language localization by @derech1e in https://github.com/jevonmao/PermissionsSwiftUI/pull/109
    • Add French (fr_FR) language localization by @Binzinz in https://github.com/jevonmao/PermissionsSwiftUI/pull/113

    New Contributors

    • @delvinwidjaja made their first contribution in https://github.com/jevonmao/PermissionsSwiftUI/pull/110
    • @derech1e made their first contribution in https://github.com/jevonmao/PermissionsSwiftUI/pull/109
    • @Binzinz made their first contribution in https://github.com/jevonmao/PermissionsSwiftUI/pull/113

    Full Changelog: https://github.com/jevonmao/PermissionsSwiftUI/compare/1.5.4...1.5.5

    Source code(tar.gz)
    Source code(zip)
  • 1.5.4(Sep 3, 2021)

  • 1.5.3(Aug 9, 2021)

  • 1.5.2(Jun 20, 2021)

    What's Fixed?

    • Fixed an issue where health permission read-only categories could show "denied" even after allowing all categories

    What Changed?

    • Health Permissions
      • The determination of authorization status changed to the new "one-drop rule" from the previous "majority take all rule"
      • Previously, the status (authorized or denied) of the majority of categories is used to determine the final authorization displayed. This means if over 50% of health permissions are allowed, then PermissionsSwiftUI will assume allowed, and vice versa.
      • Now, the "one-drop rule" will assume the authorization status as allowed when at least 1 write category has been allowed, even if all other types are denied.
      • ⚠️ Note: Apple says "to help prevent possible leaks of sensitive health information, your app cannot determine whether or not a user has granted permission to read data. If you are not given permission, it simply appears as if there is no data of the requested type in the HealthKit store." Thus, the authorization status in the case of read-only permissions is always assumed to be allowed.
    Source code(tar.gz)
    Source code(zip)
  • 1.5.1(Jun 17, 2021)

  • 1.5.0(Jun 13, 2021)

    What' New?

    NOTE: All changes in 1.5.0, including new submodules, are backward compatible and contains no breaking changes

    • Break up each permission type into its submodule (avoid App Store Review rejection)
    • Dropped minimum package deployment version to iOS 11. PermissionsSwiftUI can now be used in older projects transitioning to SwiftUI.
    Source code(tar.gz)
    Source code(zip)
  • 1.4.3(Jun 9, 2021)

    What's Fixed?

    • Fixed an issue where requesting tracking permission on device running < iOS 14.5 will crash
    • Fixed an issue where on click of allow notification permission fails and nothing happens
    Source code(tar.gz)
    Source code(zip)
  • 1.4.2(May 10, 2021)

  • 1.4.1(Apr 8, 2021)

    What's New?

    • Added CocoaPods support! You can now enjoy PermissionsSwiftUI's full functionalities in even more ways 🙌.
    platform :ios, '14.0'
    
    target 'test abstract' do
      use_frameworks!
      pod 'PermissionsSwiftUI'
    
    end
    

    What's Fixed?

    • Removed unnecessary Swift compiler warnings
    • Resolved package resource warnings
    • Fixed a potential issue with deprecated configuration APIs
    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(Apr 3, 2021)

    What's New?

    PermissionsSwiftUI 1.4.0 Evolution

    • 1.4.0 is yet another major version of PermissionsSwiftUI. To learn more, read the migration guide.

    Completion Result Handler

    • Need to access the results of the request? The completion result handler is an incredibly powerful feature. The closure returns the result of succssful and erroneous permissions as 2 parameters. You can even get the specific status of each permission.
    .JMModal(showModal: $showPermissions,
                         for: [.camera, .bluetooth, .photo],
                         onAppear: {},
                         onDisappearHandler: {(successful: [JMResult]?, erroneous: [JMResult]?) in
                    print(successful!)
                    print(erroneous!)
                })
    

    Apple Music Permission

    • New permissions! PermissionsSwiftUI now supports Apple Music, also known as the medai library or playback permission.

    Deprecated Properties

    All the configuration and customization properties in PermissionStore are deprecated and have been relocated to configStore or permissionsComponentsStore which are all new properties of PermissionStore. For help with migrating your codebase, checkout the migration guide

    Redesigned Code Base

    After a long and arduous journey, PermissionsSwiftUI underwent a massive redesign and refactor the past month. No backward-incompatible API changes are added. However, the new dependency injection design pattern should make the codebase a ton more readable and maintainable for our open source contributors 🎉🎉🎉.

    Miscellaneous

    In the exciting, all-new, PermissionsSwiftUI 1.4.0, several new public classes, structs, and protocols have been added.

    CustomizableView

    All the PermissionSwiftUI library's custom view modifiers, that is JMModal, JMAlert, as well as customizing methods such as .changeHeaderTo() now returns type some CustomizableView intead of some View.

    Although this is not technically considered a new "public API" or "feature", this is still an important change for v1.4.0. Returning type some CustomizableView means that the configuration modifiers such as .changeHeaderTo or .changeBottomDescriptionTo() can only be used in the correct context.

    This will compile because it makes sense to the library's built-in modifiers on a library's built in view:

    var body: some View {
        VStack {
            Text("PermissionsSwiftUI is the best Swift library!")
        }
        .JMModal(showModal: .constant(true), for: [.camera, .location])
        .changeHeaderTo("Jevon's Header")
        .setAccentColor(to: .red)
    }
    

    PermissionSchemaStore

    The schema storage class that coordinates PermissionsSwiftUI’s internal functions

    ConfigStore

    JMResult

    PermissionComponentsStore

    But this will not compile because it simply does not make sense:

    var body: some View {
        VStack {
            Text("PermissionsSwiftUI is the best Swift library!")
        }
        .changeHeaderTo("Jevon's Header")
        .setAccentColor(to: .red)
    }
    

    Magical, isn't it?

    What's Fixed?

    • Fixed malfunctioning customizing modifiers for JMAlert
    • Fixed tracking permission version requirement
    • Fixed typos and ambiguous texts in the official documentation
    • Various minor bug fixes

      To finish it off, this is a release we are all excited about. PermissionsSwiftUI has been and will continue to evolve with better, newer features. I would like to thank everyone in this open source community, because you gave me the motivation and support to keep building this project.
    Source code(tar.gz)
    Source code(zip)
  • 1.3.0(Mar 5, 2021)

    What's New?

    • Prevent users from dismissing the view before all permissions have interacted! Learn more in README.md 🙌 🙌 🙌
    • Completely RE-DESIGNED beautiful animation for JMAlert that is much smoother and Apple 🍎 style

    What's Fixed?

    • Fixed a bug where when trying to use configuration model for JMAlert, an incorrect JMModal will show
    Source code(tar.gz)
    Source code(zip)
  • 1.2.5(Mar 1, 2021)

  • 1.2.4(Feb 27, 2021)

    What's New?

    • The all-new, most powerful configuration for health permissions
      • The previously redundant read and write associated value parameters are now replaced by the HKAccess structure initializers
    • Configuration via model object is now supported for JMAlert style 🙌

    What's Fixed?

    • PermissionSwiftUI's official documentation 📖 is greatly enhanced!
      • Documented previously undocumented public APIs
      • Documentation is now divided with section headers to improve the reading experience
      • Certain description words and examples in the documentation are improved
    Source code(tar.gz)
    Source code(zip)
  • 1.2.3(Feb 22, 2021)

    What's New?

    • Want to show your own gorgeous colors? You can now utilize PermissionsSwiftUI's new features in 1.2.3, to easily set the accent color, primary, and tertiary colors.
    Source code(tar.gz)
    Source code(zip)
  • 1.2.2(Feb 21, 2021)

    What's New?

    • The all-new, powerful and wonderful auto authorization checking is here! PermissionsSwiftUI now will by default automatically check for permission authorization status, and only present not determined permissions or show nothing at all.
    • Want your own accent color for the buttons? You can now utilize PermissionsSwiftUI's new features in 1.2.2, to completely configure button colors (foreground and background) for all status (idle, allowed, denied).
    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(Feb 17, 2021)

    What's New?

    • A new optional customization is now available–pass in autoDismiss parameter to set whether to auto dismiss the view after last permission item is triggered
    • Some minor adjustments on the color of UI components.
    • The JMModal's background and secondary colors are interchanged
    • JMPermissions is now deprecated(name change)! Use JMModal instead

    What's Fixed?

    • Button text change animation is more natural
    • Fix a bug where contacts permission will not trigger button text change to "ALLOWED" and color
    • Fixed a major issue withJMAlert and JMPermission not displaying optimally on the smallest devices
    • Various other fixes and code refactoring to improve performance
    Source code(tar.gz)
    Source code(zip)
  • 1.2.0(Feb 12, 2021)

    What's New?

    • The all-new, beautiful and versatile permission pop-up alert 🙌
    • You now have 2 different styles of PermissionsSwiftUI to choose from
    • The pop-up alert is great for presenting permissions right before using them
    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Feb 11, 2021)

  • 1.1.0(Feb 11, 2021)

    What's New?

    • Health permission is now supported! 😃
    • onAppear and onDisappear method offered to override behavior, available as closure parameters for JMPermissions!

    Features

    • ALL 12 iOS system SUPPORTED
    • Displays a SwiftUI modal view to handle user interaction and iOS permissions
    • Beautifully designed, Apple native style UI
    • Customizable title and description texts
    • Customizable image icon, name, and detailed description for each permission item
    • Stunning hand-picked SF Symbols to represent each permission
    • Fully documented, easy to use. Start using PermissionsSwiftUI with SINGLE LINE OF CODE
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Feb 8, 2021)

  • 1.0.0(Feb 8, 2021)

    What's New?

    • Auto dismiss PermissionsSwiftUI modal after last permission is allowed

    • Simplified core APIs for permissions customization

    • All old APIs for changing permissions components are obsolete

    • Use the newer, better view modifier to achieve same effect

    Features

    • ALL 12 iOS system SUPPORTED
    • Displays a SwiftUI modal view to handle user interaction and iOS permissions
    • Beautifully designed, Apple native style UI
    • Customizable title and description texts
    • Customizable image icon, name, and detailed description for each permission item
    • Stunning hand-picked SF Symbols to represent each permission
    • Fully documented, easy to use. Start using PermissionsSwiftUI with SINGLE LINE OF CODE
    Source code(tar.gz)
    Source code(zip)
  • 0.0.2(Feb 8, 2021)

    ⚠️This version simply deprecates certain APIs from 0.0.1

    Please update your Xcode Project's PermissionsSwiftUI to version 1.0.0 as soon as possible if you are still using 0.0.1 or 0.0.2 in your project.

    Features (Old)

    • ALL 12 iOS system SUPPORTED
    • Displays a SwiftUI modal view to handle user interaction and iOS permissions
    • Beautifully designed, Apple native style UI
    • Customizable title and description texts
    • Customizable name and detailed description for each permission item
    • Stunning hand-picked SF Symbols to represent each permission
    • Fully documented, easy to use. Start using PermissionsSwiftUI with SINGLE LINE OF CODE
    Source code(tar.gz)
    Source code(zip)
  • 0.0.1(Feb 3, 2021)

    Features

    • ALL 12 iOS system SUPPORTED
    • Displays a SwiftUI modal view to handle user interaction and iOS permissions
    • Beautifully designed, Apple native style UI
    • Customizable title and description texts
    • Customizable name and detailed description for each permission item
    • Stunning hand-picked SF Symbols to represent each permission
    • Fully documented, easy to use. Start using PermissionsSwiftUI with SINGLE LINE OF CODE
    Source code(tar.gz)
    Source code(zip)
Owner
Jevon Mao
Current high school student. Swift Language contributor. Intern @ Luma. Swift, iOS, and Python guru.
Jevon Mao
RSA public/private key encryption, private key signing and public key verification in Swift using the Swift Package Manager. Works on iOS, macOS, and Linux (work in progress).

BlueRSA Swift cross-platform RSA wrapper library for RSA encryption and signing. Works on supported Apple platforms (using Security framework). Linux

Kitura 122 Dec 16, 2022
Swift Package for fetching approximate user location without asking for their permission 👺 .

Earendil Swift Package for fetching approximate user location without asking for their permission ?? . Get their country, subregion or continent with

Przemysław Jabłoński 4 Sep 3, 2021
Ported Shamirs Secret Sharing Into A Swift Package

Shamirs-Secret-Sharing-Swift Ported Shamirs Secret Sharing Into A Swift Package Based on Adi Shamir's Secret Sharing (https://en.wikipedia.org/wiki/Sh

Charles Edge 5 May 15, 2022
Swift package wrapping the OpenWall BCrypt hashing algorithm

SwiftBCrypt A simple Swift Package wrapping the OpenWall BCrypt hashing algorithm. Generate Salt let bcryptSalt = try BCRypt.makeSalt() Hash Phrases

Tanner Silva 1 Jul 8, 2022
Generate passwords and save them in Keychain. Made with SwiftUI.

lockd Generate strong passwords and save them in Keychain. Join lockd Beta on TestFlight: https://testflight.apple.com/join/xJ5AlvS3 Features: Generat

Iliane 56 Dec 29, 2022
Virgil Core SDK allows developers to get up and running with Virgil Cards Service API quickly and add end-to-end security to their new or existing digital solutions to become HIPAA and GDPR compliant and more.

Virgil Core SDK Objective-C/Swift Introduction | SDK Features | Installation | Configure SDK | Usage Examples | Docs | Support Introduction Virgil Sec

Virgil Security, Inc. 27 Jul 26, 2022
Safe and easy to use crypto for iOS and macOS

Swift-Sodium Swift-Sodium provides a safe and easy to use interface to perform common cryptographic operations on macOS, iOS, tvOS and watchOS. It lev

Frank Denis 483 Jan 5, 2023
Native and encrypted password manager for iOS and macOS.

Open Sesame Native and encrypted password manager for iOS and macOS. What is it? OpenSesame is a free and powerful password manager that lets you mana

OpenSesame 432 Jan 7, 2023
Simple, secure password and data management for individuals and teams

Padloc Simple, secure password and data management for individuals and teams (formerly known as Padlock). This repo is split into multiple packages: P

Padloc 2.1k Jan 8, 2023
PGPro can encrypt and decrypt messages as well as manage all your OpenPGP keys. It is free, simple and lightweight. Everything stays on your device. PGPro is made in Switzerland.

PGPro can encrypt and decrypt messages as well as manage all your OpenPGP keys. It is free, simple and lightweight. Everything stays on your device. P

Luca Näf 250 Jan 4, 2023
A wrapper to make it really easy to deal with iOS, macOS, watchOS and Linux Keychain and store your user's credentials securely.

A wrapper (written only in Swift) to make it really easy to deal with iOS, macOS, watchOS and Linux Keychain and store your user's credentials securely.

Ezequiel Aceto 2 Mar 29, 2022
Cloak Swift - a tool and Tuist plugin to encrypt secrets and then pass them in an obfuscated form into applications

This is Cloak Swift - a tool and Tuist plugin to encrypt secrets and then pass them in an obfuscated form into applications.

Andrew Lord 3 Nov 9, 2022
CryptoSwift is a growing collection of standard and secure cryptographic algorithms implemented in Swift

CryptoSwift Crypto related functions and helpers for Swift implemented in Swift. (#PureSwift) Note: The master branch follows the latest currently rel

Marcin Krzyzanowski 9.4k Jan 5, 2023
A framework for the JOSE standards JWS, JWE, and JWK written in Swift.

JOSESwift is a modular and extensible framework for the JOSE standards JWS, JWE, and JWK written in Swift. ?? Please note that this implementation of

Airside Mobile, Inc. 162 Dec 15, 2022
CCCryptor (AES encryption) wrappers for iOS and Mac in Swift. -- For ObjC, see RNCryptor/RNCryptor-objc

RNCryptor Cross-language AES Encryptor/Decryptor data format. The primary targets are Swift and Objective-C, but implementations are available in C, C

null 3.3k Dec 30, 2022
Simple and secure hashing in Swift with the SipHash algorithm

SipHash ⚠️ WARNING This package has been obsoleted by the Hasher type and the Hashable.hash(into:) requirement introduced in Swift 4.2. Using this pac

null 262 Dec 19, 2022
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Cossack Labs 1.6k Dec 30, 2022
Helper functions for saving text in Keychain securely for iOS, OS X, tvOS and watchOS.

Helper functions for storing text in Keychain for iOS, macOS, tvOS and WatchOS This is a collection of helper functions for saving text and data in th

Evgenii Neumerzhitckii 2.3k Dec 28, 2022
Simple Swift wrapper for Keychain that works on iOS, watchOS, tvOS and macOS.

KeychainAccess KeychainAccess is a simple Swift wrapper for Keychain that works on iOS and OS X. Makes using Keychain APIs extremely easy and much mor

Kishikawa Katsumi 7.2k Dec 30, 2022