This sample app demonstrates the configuration of a Swift app using the ArcGIS Runtime SDK for iOS. You can either take this and run with it, or follow the steps below to create your own from scratch.
ArcGIS Runtime SDK for iOS v10.2.3
- Install the SDK and then download and run the script from here. This script will allow the ArcGIS framework to be imported from Swift.
- Open Xcode 6 Beta (7 at time of writing) and create a new project ensuring the language is set to Swift.
- Next we will configure the application to use the ArcGIS framework. Select your application target and then the "Build Settings" pane. We will be adding
Other Linker Flags
as well asFramework Search Paths
to our project configuration. Add all of the following in bold below.
- At this point we can start to add some code. Open ViewController.swift in your application and add an
import ArcGIS
at the top of the file after theimport UIKit
line. This exposes the ArcGIS objects to your ViewController. - Once you have imported the framework, move to the
viewDidLoad
method and add the following code
var mapView = AGSMapView(frame: view.bounds)
mapView.autoresizingMask = .FlexibleWidth | .FlexibleHeight
mapView.addMapLayer(AGSOpenStreetMapLayer())
view.addSubview(mapView)
Your ViewController.swift file should now look like the following: