SettingsAppAccess 1.0.3

SettingsAppAccess 1.0.3

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2016
SPMSupports SPM

Maintained by Ian Grossberg.



  • By
  • Ian G

SettingsAppAccess

SettingsAppAccess is a simple iOS library that will send your Users to various locations with the iOS Settings App.

Installation

SettingsAppAccess is available through CocoaPods, to install simple add the following line to your Podfile:

  pod "SettingsAppAccess"

Alternatively you can add the github repo as a submodule and use SettingsAppAccess as a framework.

Carthage support soon!

Usage

Setup

Before you can successfully open up a location with iOS’ Settings App you must add a URL Type to handle its protocol to your app:

  1. Open your app target’s Info page
  2. Expand URL Types
  3. Press the + Button to add a new URL Type
  4. Set URL Schemes to prefs

URL Types - prefs

Now we’re ready to use the library!

SettingsAppAccess defines the enum SettingsAppLocation which contains the paths to various known locations in the iOS Settings App.

UIApplication Extension

The library provides an extension to UIApplication to accept our SettingsAppLocation enum:

    do {
        try UIApplication.sharedApplication().settingsAppAccess_openLocation(SettingsAppLocation.Settings)
    } catch let error as NSError {
        ...
    }

Manually

One can use the enum directly to create an NSURL, and call openURL:

    do {
        let url = try SettingsAppLocation.Settings.URL()
        let openURLResult = UIApplication.sharedApplication().openURL(url)
    } catch let error as NSError {
        ...
    }

One can also use the rawValue of the enum directly, manually create an NSURL, and call openURL:

    guard let url = NSURL(string: SettingsAppLocation.Settings.rawValue) {
        return 
    }
    let openURLResult = UIApplication.sharedApplication().openURL(url)

Contributing

If you have additional iOS Settings App paths please feel free to create an issue or a pull request and they will get added to the library!

If you have any ideas, suggestions or bugs to report please create an issue labeled feature or bug (check to see if the issue exists first please!) or create a pull request!

Translation

The human readable names list is localized, anyone who would like to translate the list into a language they know should create a pull request!

Thanks to Sweeper777 for Simplified and Traditional Chinese as well as Japanese translations!

Library Name

PS: If you think you have a better name than SettingsAppAccess please create an issue, SettingsAppAccess is a mouthful…of bleh!

Thanks

This library was inspired by this post by Sofia Swidarowicz (http://phyline.com) and based on her original list and all its contributers!