
# Nonstop Swift SDK

## Initialization

Initialize the Nonstop SDK in your AppDelegate.

### Initialization

The initialize method takes a Nonstop config as a parameter.

You can supply NonstopConfig with no values set and it will default to no Amplitude tracking and hitting the Dev Nonstop environment.

* Optionally you can pass an Amplitude API Key and this will be used to report build in Amplitude events to.
* Optionally you can pass an Environment Enum, this will determine which Nonstop Environment API the SDK uses.

#### Use defaults

```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    let config = NonstopConfig()
    Nonstop.sharedInstance.initialize(with: config)
    return true
}
```

#### Specify Values

```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    let config = NonstopConfig(amplitudeApiKey: "4d2b68c10cb3c95f6535b76aebcacdf2",  environment: .Staging)
    Nonstop.sharedInstance.initialize(with: config)
    return true
}
```

#### Environments

The Environments parameter controls which APIs the SDK will hit, and thus which Nonstop Admin and ShowMS Environment is tied to them. Developers should be conscious of this and match their Nonstop Environment to their ShowMS environment for the given build.

* **Dev**
  * Admin - <https://dev.admin.nonstopapp.co/>
  * Client API - <https://dev.api.nonstopapp.co/swagger/index.html>
  * ShowMS Web - <http://dev.showms.freeform.go.com/>
  * ShowMS Admin - <http://dev.admin.freeform.showms.com/>
  * ShowMS API - <https://dev.api.showms.com/swagger/ui/index>
* **Staging**
  * Admin - <https://staging.admin.nonstopapp.co/>
  * Client API - <https://staging.api.nonstopapp.co/swagger/index.html>
  * ShowMS Web - <http://staging.showms.freeform.go.com/>
  * ShowMS Admin - <http://staging.admin.freeform.showms.com/>
  * ShowMS API - <https://staging.api.showms.com/swagger/ui/index>
* **QA**
  * Admin - <https://qa.admin.nonstopapp.co/>
  * Client API - <https://qa.api.nonstopapp.co/swagger/index.html>
  * ShowMS Web - <http://qa.showms.freeform.go.com/>
  * ShowMS Admin - <http://qa.admin.freeform.showms.com/>
  * ShowMS API - <https://qa.api.showms.com/swagger/ui/index>
* **Production**
  * Admin - <https://admin.nonstopapp.co/>
  * Client API - <https://api.nonstopapp.co/swagger/index.html>
  * ShowMS Web - <http://freeform.go.com/>
  * ShowMS Admin - <http://admin.showms.com/>
  * ShowMS API - <https://api.showms.com/swagger/ui/index>

#### Reward Animations

Note: The Nonstop SDK will asynchronously preload reward animations on initialize for improved performance when they are required so you may see this network call on app start.
