Select to view content in your preferred language

How do I get started building an iOS app?

569
4
07-07-2024 04:36 PM
FrankLaRosa
New Contributor

Hi, I'm starting an iOS app with ArcGis, and it is the first time I have used it. I have a couple of immediate questions.

Should I use one of the iOS SDKs or should I use the REST interface? I am comfortable doing either, but I don't want to make a lot of extra work for myself.

It appears to me that the newest iOS SDK is for Swift-UI only, which is not something I want to use. But I am also seeing that you are discouraging people from using the old SDK, which is concerning. Does this mean that in the future there will be no support for iOS unless SwiftUI is used?

I have an API key that was provided to me by the customer who hired me to do the work. I do not directly have access to his account. Can I progress just using the API key or do I need more? I'm a little confused by all of the OAuth stuff being mentioned. What is the procedure for using the API key?

Is there some kind of beginning tutorial or sample app that I can use for reference? 

Thanks,

Frank

0 Kudos
4 Replies
rolson_esri
Regular Contributor

Should I use one of the iOS SDKs or should I use the REST interface? I am comfortable doing either, but I don't want to make a lot of extra work for myself.

If you are building a native iOS app, the ArcGIS Maps SDK for Swift would be our top recommendation. Of course you can also target iOS with the .NET or Qt SDKs as well. And a Flutter SDK is in beta at the moment, which could eventually be used as well.

Using one of the SDKs instead of the REST interface is highly recommended and will save you a ton of effort. Of course the more your app does, the more time one of our SDKs will save you.

It appears to me that the newest iOS SDK is for Swift-UI only, which is not something I want to use. But I am also seeing that you are discouraging people from using the old SDK, which is concerning. Does this mean that in the future there will be no support for iOS unless SwiftUI is used?

Correct. The latest iOS SDK, the Swift SDK, is targeting SwiftUI. It's important to note that SwiftUI and UIKit integrate very well. So you can still use UIKit as the basis of your app, but the aspects dealing with ArcGIS would need to have that SwiftUI bridge. We highly recommend fully moving to SwiftUI as it is a very productive platform for building iOS applications. And that comes from a team that has deep experience with both UIKit and SwiftUI.

The 100.15 release of the iOS (Objective-C/UIKit based) SDK will eventually go out of support and not be actively  patched. We do not recommend 100.15 for new development at this stage of its support.


I have an API key that was provided to me by the customer who hired me to do the work. I do not directly have access to his account. Can I progress just using the API key or do I need more? I'm a little confused by all of the OAuth stuff being mentioned. What is the procedure for using the API key?

An API Key will provide you access to some basemaps and services. I would assume that the API Key will provide you access to what you need to develop the application if the customer provided it. 

 

Is there some kind of beginning tutorial or sample app that I can use for reference? 

There are many samples and tutorials available. You can find links to those from the main page of the Swift SDK. 

Nicholas-Furness
Esri Regular Contributor

Hello Frank.

Thanks for reaching out. Firstly, you will benefit tremendously by using the ArcGIS Maps SDK for Swift over direct REST requests (unless you're just making very simple calls to the ArcGIS Location Platform places or geocoding service).

We have numerous tutorials at the SDK's homepage: https://developers.arcgis.com/swift/

I suggest you start with this one, which will introduce you to some concepts around API Keys and the SDK in general: https://developers.arcgis.com/swift/maps-2d/tutorials/display-a-map/

But I also suggest you go through the getting started pages at the SDK homepage.

You can also see these blog posts that we wrote around getting started with the SDK, although they will probably be slightly out of date as we just made some major changes to how API Keys are created and managed:

The new ArcGIS Maps SDK for Swift is the modern continuation of the old ArcGIS Runtime SDK for iOS. Learn more here where we first announced the modernization of our SDKs back in April 2022, and here, where we cover the initial release of the new SDKs later that year. With that in mind, we do indeed discourage use of the old Objective-C ArcGIS Runtime SDK for iOS (which provided UIKit UX components), and although it is a long-term support release, it will eventually cease to receive support. Apple's stated path forward is Swift and Swift UI, and this is what we've committed to with the ArcGIS Maps SDK for Swift. However, Apple provide an easy way to use the Swift UI components with UIKit using a UIHostingController (see Apple's doc here and here), and we have customers who are successfully doing this.

As for authentication, you can learn all about using our API Keys and OAuth here: https://developers.arcgis.com/swift/security-and-authentication/

Which one you will use will depend on the type of app you're building and who will be using it. As a general guide, many Esri end users are direct users of the ArcGIS system and have their own logins which enable access to content and services. These customers may well need to use OAuth authentication. But if you are building apps that are to be used by end-users without an ArcGIS login, an API Key is more appropriate.

I recommend you create yourself a free ArcGIS Location Platform account which will allow you to create and use API Keys of your own. There are generous free monthly allowances allowing for development and testing, and which can also be used in production. If your customer has given you an API Key, you can certainly use that and it ensures that any usage beyond the free allowance will be billed to them (or just fail if they haven't set up payment methods), but there are a couple of disadvantages to that that I can think of. Firstly, API Keys are scoped, and if you need to provide access to additional services, the customer who hired you will become a bottleneck. Secondly, you won't have insight into usage levels for the API Keys, nor the ability to create additional ones. However, if the API Key is just going to be used for simple stuff like accessing basemaps and performing geocodes or place searches, you might be able to get away with it. More likely though, using your own account during development and testing will work well, and then the customer can provide an API Key for production.

I hope that helps.

FrankLaRosa
New Contributor

Thanks for the responses.

I'm disappointed by this attitude toward iOS development. Storyboards are still fully supported by Apple and something I prefer to use. I have been an iOS developer since 2009 so I'm not new to the subject. I hope you will reconsider your decision to abandon this support.

0 Kudos
Ting
by Esri Contributor
Esri Contributor

Since the ArcGIS MapView is pretty self-contained, using a SwiftUI View in UIHostingController isn't really all that different from the traditional Storyboard workflow. You can still adjust the wireframe of a UIHostingController in the storyboard - it is just a wrapper around a SwiftUI View. I encourage you to give it a try and see if you have any difficulties embedding it to the storyboard.

As mentioned by Ryan and Nick above, there are many benefits using the new Swift SDK. It's a first-class Swift-native SDK that uses the latest and greatest Swift advancements, such as Swift Concurrency, networking, better use of value types, protocol-oriented design, etc. that the old Objective-C-based SDK won't be able to support.

We have a sample that showcases both way compatibility - using a SwiftUI view in UIKit (UIHostingController), and using a UIKit view in SwiftUI (UIViewRepresentable + AGSMapView).