ResourceOptionsManager
public class ResourceOptionsManager
Convenience class that manages a global ResourceOptions
It’s possible to create ResourceOptionsManager
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.
ResourceOptionsManager.default.resourceOptions.accessToken = "overridden-access-token"
return true
}
```
-
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 static var `default`: ResourceOptionsManager { get }
-
Convenience function to remove the default instance. Calling
default
again will re-create the default instance.Declaration
Swift
public static func destroyDefault()
-
Return the current resource options.
Declaration
Swift
public var resourceOptions: ResourceOptions { get set }
-
Initializes a
ResourceOptionsManager
with an optional access token.If the supplied token is nil (which is the case for the
default
) then we will use appropriate defaults for theResourceOptions
, including searching for an access token in the application’s Info.plist.You can override the shared global access token, using
ResourceOptionsManager.default
:``` ResourceOptionsManager.default.resourceOptions.accessToken = "overridden-access-token" ```
Declaration
Swift
public convenience init(accessToken: String? = nil)
Parameters
accessToken
Valid access token or
nil
-
Initializes a
ResourceOptionsManager
with the specifiedresourceOptions
.Declaration
Swift
public convenience init(resourceOptions: ResourceOptions)
Parameters
resourceOptions
Resource options to initialize the manager with.