CredentialsManager
public class CredentialsManager
extension CredentialsManager: Equatable
extension CredentialsManager: CustomStringConvertible, CustomDebugStringConvertible
Convenience class that holds MapboxMaps related secrets.
It’s possible to create CredentialsManager
instances as you need them,
however it’s convenient to use the default object (default
).
For example, we recommend that the Mapbox access token be set in
application(_:didFinishLaunchingWithOptions:)
rather than relying on the
value in your application’s Info.plist:
```
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
CredentialsManager.default.accessToken = "overridden-access-token"
return true
}
```
-
Access token.
This property has “null resettable” behavior; if you set
accessToken
tonil
, we will return the application’s default access token.Declaration
Swift
public var accessToken: String! { get set }
-
Default instance
This shared instance is used by the default initializers for
ResourceOptions
andMapInitOptions
.The application’s Info.plist will be searched for a valid access token under the key
MBXAccessToken
A valid access token must be provided or found.
Declaration
Swift
public private(set) static var `default`: CredentialsManager { get }
-
Initializes a CredentialsManager with an access token.
If the supplied token is nil (which is the case for the
default
) then we will search for an access token in the application’s Info.plist. Use the sharedCredentialsManager.default
to set a globally shared access token.Declaration
Swift
public convenience init(accessToken: String?)
Parameters
accessToken
access token or nil
-
Declaration
Swift
public static func == (lhs: CredentialsManager, rhs: CredentialsManager) -> Bool