Setting Up the SDK

Once you've integrated the Xweather iOS SDK into your project, you'll need to setup your project to start using the SDK.

The Xweather iOS SDK is written in Objective-C, but since it's pre-compiled as dynamic frameworks, it's easy to use in either Swift or Objective-C projects. Use either the Swift or Objective-C methods below to get started.

  1. Make sure you have an active Xweather subscription and have valid API keys for use under your account for your application. Follow the Xweather Weather API getting started (opens in a new tab) guide if you haven't completed this process yet.

  2. Import AerisWeatherKit in the application delegate:

    import AerisWeatherKit
  3. Setup the SDK with your application's API keys in the application:didFinishLaunchingWithOptions: application delegate method:

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        Xweather.start(withApiKey: "__CLIENT_ID__", secret: "__CLIENT_SECRET__")
        window = UIWindow(frame: UIScreen.mainScreen().bounds)
        window?.backgroundColor = UIColor.whiteColor()
        return true
  4. In the Swift files you wish to use any of the Xweather iOS SDK libraries, import the appropriate modules:

    import AerisWeatherKit
    import AerisMapKit
    import AerisMapboxMapKit
    import AerisGoogleMapKit
  5. You're now ready to start loading data in your application! Review our data loading or weather map guides for more information and examples. You can also reference the complete set of developer API docs for each SDK for more information about classes, methods and properties.

Logging & Debugging

By default, the logging level of the Xweather iOS SDK is set to output for the warning and error levels only. However, during development you may need to view more detailed output when using the SDK, such as requests being made or other informational details.

You can toggle debug mode on or off depending on how much logging output you need. By default debug mode is disabled. However, you can enable it in your application delegate:

AerisWeather.sharedInstance().debugMode = true

To disable debug mode, just pass NO or false to the above method, or remove the call to setDebugMode: and the SDK will fall back to the default of debug mode being disabled.