Select to view content in your preferred language

Just gotta ask, is ESRI going to support the new Swift language for iOS?

1743
6
Jump to solution
06-03-2014 02:52 PM
JerryChapman
Deactivated User
ESRI going to support Swift programming language?

Thanks,

Jerry
0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor
So far, it seems to be working...  The key was to add ArcGIS.h to the "Objective-C Bridging Header" setting under Swift Compiler - Code Generation of Build Settings.


Throwing this out there too... In the case where you have a Swift-only project, you can also do the trick described in this Gist.

You'll need an
import ArcGIS
statement in the .swift file too.

E.g.
import UIKit import ArcGIS  var tileUrl = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"  class ViewController: UIViewController {      @IBOutlet var mapView : AGSMapView          override func viewDidLoad() {         super.viewDidLoad()         // Do any additional setup after loading the view, typically from a nib.                  var myLayer = AGSTiledMapServiceLayer(URL: NSURL(string: tileUrl))         mapView.addMapLayer(myLayer)     } }


Enjoy!

Nick.

P.S. I guess I should add that (as mentioned in the Gist) this isn't supported by Esri yet. Use at your own risk 🙂

View solution in original post

0 Kudos
6 Replies
raffia
by
Deactivated User
Very interesting, was wondering about the same thing. Also wondering for a first release, will all the funcctionalities of the sdk be preserved.
0 Kudos
JohnDye
Deactivated User
With ESRI going all in on Python, and Apple comparing Swift to Python several times at WWDC, I imagine ESRI will probably come to support it. I wouldn't expect to see it at the 2015 DevSummit, but hopefully 2016. The good thing is that since it is interoperable with Obj-C APIs, you should be able to mix-and match as needed until ESRI can release a full blown Swift SDK.
0 Kudos
mikedavis2
Occasional Contributor
The way I understand Apple's intentions I don't think there is anything for ESRI to support.  Xcode will create swift bindings to the Objective C classes automatically.

I guess they could start doing documentation and demos with swift code
0 Kudos
rbae
by
Regular Contributor
So far, it seems to be working...  The key was to add ArcGIS.h to the "Objective-C Bridging Header" setting under Swift Compiler - Code Generation of Build Settings.
0 Kudos
Nicholas-Furness
Esri Regular Contributor
So far, it seems to be working...  The key was to add ArcGIS.h to the "Objective-C Bridging Header" setting under Swift Compiler - Code Generation of Build Settings.


Throwing this out there too... In the case where you have a Swift-only project, you can also do the trick described in this Gist.

You'll need an
import ArcGIS
statement in the .swift file too.

E.g.
import UIKit import ArcGIS  var tileUrl = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"  class ViewController: UIViewController {      @IBOutlet var mapView : AGSMapView          override func viewDidLoad() {         super.viewDidLoad()         // Do any additional setup after loading the view, typically from a nib.                  var myLayer = AGSTiledMapServiceLayer(URL: NSURL(string: tileUrl))         mapView.addMapLayer(myLayer)     } }


Enjoy!

Nick.

P.S. I guess I should add that (as mentioned in the Gist) this isn't supported by Esri yet. Use at your own risk 🙂
0 Kudos
DiveshGoyal
Esri Regular Contributor
Thanks, Nick.
That gist works great!
0 Kudos