Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
MikeDoyle
Active Contributor
The SAP Cloud Platform SDK for iOS helps us to build native iOS apps that connect seamlessly to back-end systems like S/4HANA and ECC.  Of course, SAP Cloud Platform makes it all happen, acting as a kind of middleware between the device and the OData server.

Why would we want to build native iOS apps?  Whilst web apps and hybrid apps are getting better and better there are still some features that are only available with native apps.  Examples are the AR kit (augmented reality), speech recogniser, push notifications and offline (the later two are also available for hybrid apps).  Arguably, native gives the best possible experience for that device and the design can be perfectly in tune with that OS.  The downside is that native apps can be more expensive to develop and maintain (particularly compared to web apps).

Recently I used the SDK for iOS to build a proof-of-concept (POC) offline app.  My background is as an SAP-ecosystem developer (ABAP, Java, JavaScript, UI5, OData...) rather than an iOS specialist.  I thought I would share my experiences in the hope that they might help other developers with a similar background.

So here are some tips to get you started with the SDK for iOS:

Step into the Mac store


You need to have access to macOS in order to use the SDK. If you are wondering about hardware requirements, my 2016 MacBook Pro with 8GB of RAM and SSD copes fine, at least with the smallish app I was building.  If you want to test your app on a real iPad or iPhone then that device will need to be on iOS 10 or iOS 11.

Step away from the App store


To get up and running you need to install Xcode (the IDE) and the SAP SDK.  Before you download Xcode be sure the check the SDK download page for compatibility with Xcode versions.  When a new version of Xcode comes out it might not be supported by the SDK, so you might need to download the previous version (of Xcode).


App running slow in the simulator?


Xcode has a superb companion simulator, which you can use to test your app on a myriad of virtual iPhones and iPads.  Shortly before a demo I found my app was rendering very slowly in the simulator.  Somehow I had turned on the slow animations feature.  Watch out for that one!  You can turn it off by pressing COMMAND-T.

There are lots of other shortcuts to simulate interaction with a real device, such as COMMAND-SHIFT H H to close your app.

Upgrading the SDK


We can use the Assistant, a standalone macOS application, to generate apps for us.  The resulting app is pretty much fully formed, with all of the authentication, on-boarding and OData calls, for example, generated for us.  Of course, unless your app is a simple OData browser, you are going to need to add all of your UI and make use of all of those native frameworks.

The assistant's work doesn't end however with the generated app. The SDK for iOS is upgraded quite frequently and that includes changes to the SAP-provided frameworks which provide all that authentication, integration and Fiori UI.  If you have an app built with a previous version of the SDK the (newly upgraded) Assistant will upgrade it for you.  Just select the app in the assistant and choose Refresh Frameworks.


We don't build apps in the SDK


Before I started using the SDK I thought it's what we use to build the iOS apps.  Wrong!  It makes much more sense to think of the SDK for iOS as a kind of accelerator.  The SDK gives you a big head-start by generating code for you and showing you how to use the SAP frameworks.  At the end of the day, however, you are still building iOS apps in Xcode.  You are going to have to learn how to build a UI yourself, and you have some new concepts to learn.  For example, I had to learn that the back button needed to trigger something called a 'reverse segue'.



Don't get me wrong, I think the SDK is a great tool and I don't think anyone at SAP has been misleading people.  My point is just that it's designed to bring iOS specialists into the SAP tent.  Non-specialists like you and I need to learn the basics of Swift, Xcode and iOS before we can really be productive.

Learning Swift


The iOS development world is currently undergoing a transition from Objective-C to Swift and the two languages are interoperable.  Objective-C has been around since the early 1980s whereas Swift was only released to the world in 2014.  SAP have written all of their frameworks in Swift and we are encouraged to use Swift to build our apps.

Swift aims to be as easy to work with as Ruby or Python yet run as fast as C or Java. Like ABAP it is usually compiled, unlike JavaScript which is usually interpreted. Like ABAP it is strongly-typed, reducing run-time errors.  Like Java and JavaScript the syntax borrows from C, although Swift looks to be more of a distant relative than those two languages.  It's been open source since 2015.

I encourage you to read up on Swift and to try out the Swift Playgrounds iPad app.  It's quite an advanced language and some of the concepts justify a bit of study and practice.  You can also take a Swift Tour.  My tip is to read up on optionals.

How do iOS apps compare to UI5 apps?


In my opinion a lot more code is required for an iOS app than a UI5 app.  I haven't found a way (yet) to bind a whole page of controls to a particular OData entity and you need to write code (in the view controller) to set each field value.  Of course, a UI5 Fiori app is piggybacking on the Fiori launchpad, which in turn is running in a browser or the Fiori Client.  In contrast, our iOS app is interacting directly with the OS.  That gives the iOS app greater flexibility but also added complexity.

The OS uses the AppDelegate.swift file to launch the app.  It's analogous to the way in which a Fiori Launchpad uses the Component.js file to launch a Fiori app.  The view controllers fulfill a similar role in both.  With iOS we create outlets to manipulate controls from the view control and actions are the event handlers.

Get stuck in!


If you want to explore the SDK and build iOS apps go ahead, even if you don't have an iOS background.  If you want to build a proof-of-concept my advice would be the same.  However, if you are building a complex app, or taking the app live then I would recommend bringing in someone who does have that experience.  It's been GA (general availability) since March 2017 and it's reached a good level of maturity in my opinion.

Where do I get more information?


There are lots of SAP tutorials on the SDK.  One of my favourites is Create custom iOS app with SDK Assistant, because it shows you how to get started with your own UI.  This Apple tutorial: Start Developing iOS Apps (Swift) is also highly recommended.  It doesn't mention the SAP SDK for iOS at all but it gives you the basics of UI-building in iOS (including reverse segues).

The resources page has videos and links to all the documentation, including the API-level documentation for the SAP frameworks.  The SAP Help is here, behind the product page.

Ready to start?  You can download the SDK for iOS here.

daniel.vanleeuwen wrote a great series of blog posts about the SDK, starting with Getting Started with the SAP Cloud Platform SDK for iOS – Part 1.

Follow andreas.schlosser for all the latest SDK updates, such as this blog post on the latest service packrobin.vanhethof wrote many of the tutorials and also blog posts about using GIT with the SDK and the Mentor app (which we can use to browse the Fiori controls). ian.thain is a longstanding enthusiast for the SDK and he's done many code talks on it.

Talks


I'll be doing a talk on the SDK at SAP Inside Track Brisbane (Australia), on Wednesday September 5th.  I'll also be doing an ASUG session at Tech Ed Las Vegas.  Here are the details:

  • CGE225

  • Thursday, Oct 04, 2018

  • 10:30 AM-11:30 AM

  • Titian 2202


If you're heading to Tech Ed Las Vegas & you want to learn more about the SDK for iOS, why not come along?
MacBook Pro, iPhone, iPad, macOS and Xcode are trademarks of Apple Inc., registered in the U.S. and other countries

 
4 Comments
Labels in this area