Bluemix Mobile Starter for Weather in Swift
The Bluemix Mobile Starter for Weather showcases getting a forecast using the coordinates from Apple Maps and gives you integration points for each of the Bluemix Mobile services.
- iOS 8.0+
- Xcode 8.0
- Swift 3.0
This starter uses the Bluemix Mobile services SDKs to use the functionality of the Mobile Analytics, Push Notifications, and Weather services.
The Bluemix Mobile services SDK uses CocoaPods to manage and configure dependencies. To use our latest SDKs, you need version 1.1.0.rc.2.
Install CocoaPods using the following command:
$ sudo gem install cocoapods --pre
If the CocoaPods repository is not configured, run the following command:
$ pod setup
For this starter, a pre-configured Podfile
is included in the ios_swift/Podfile location. To download and install the required dependencies, run the following command in the ios_swift directory:
$ pod install
Open the Xcode workspace: {APP_Name}.xcworkspace
. Continue to open the .xcworkspace
file as it contains all the dependencies and configurations.
If you run into any issues during the pod install, it is recommended to run a pod update by using the following commands:
$ pod update
$ pod install
Once the dependencies have been built and configured for the Bluemix Mobile service SDKs, configure the Weather credentials for the application. If you have not already created the Weather service on Bluemix, go to the Bluemix Catalog and create a Weather service instance.
A WeatherCredentials.plist
configuration file is included in the Xcode project that includes credential configurations for Weather service:
Key | Value |
---|---|
host | twcservice.mybluemix.net |
username | 6123kljda-e486-4bcf-89ed-063050df742f |
password | zlkj23lkf |
Find the credentials for your WeatherCredentials.plist
file by clicking the Service Credentials button:
Click Product > Run to start the app in Xcode.
The application allows you determine the forecast of any location using your Weather instance on Bluemix. Long click to view the forecast.
This package contains code licensed under the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 and may also view the License in the LICENSE file within this package.