One week after Apple’s release of Xcode 9 and iOS 11 we’ve now shipped a new major release of our SAP Cloud Platform SDK for iOS 2.0 – download here – (and we also updated 1.0 SP02 to be compatible with Xcode 9). We added a couple cool features that I’ll briefly highlight here – you can get the full story and much more background information in our documentation.
Let’s first cover the basics; you will need Xcode 9 in order to use the latest SDK – I’ve explained the background and complications of Swift binary compatibility in another blog – Xcode 8.3 will not work. This is also true for the latest 1.0 release, going forward we will support Xcode 9 only for your development.
We continue to support iOS 10 on both major SDK releases, so you can build iOS 10 and iOS 11 apps using the most current 1.0 SP02 patch as well as using the 2.0 version.
The Assistant will work fine on macOS Sierra and High Sierra.
Upgrading from 1.x
Simply drag and drop the new Assistant 2.0 from the DMG into your /Applications folder – done. Existing projects that have been created with the Assistant can be upgraded with the ‘Refresh frameworks…’ context menu. For other Xcode projects – simply replace the frameworks.
In most cases the migration should work effortless. In rare cases you will see ‘fix-it’ suggestions from Xcode because we did streamline our APIs in some places, you can also find more detail in the ‘Migration’ section of our docs – only look at this if things go sideways.
Note on Swift 3.2 vs Swift 4: while in theory these two can be freely mixed, we saw problems when using the SDK 2.0 (written in Swift 4) with a Swift 3.2 source code project. We are working with Apple to analyze and fix these, for the time being, please upgrade your projects to Swift 4, when upgrading to SDK 2.0
You will notice the fresh look when you start the Assistant for the first time. It is now much more aligned with the UX of other native macOS apps. In particular, the settings screen is much tidier:
This also hints at two of the great new features that we’ve added to the Assistant in this release. The Assistant doesn’t only connect to SAP Cloud Platform Mobile Services, but can now also interact with SAP API Management Developer Portal as well as SAP Translation Hub.
We’ve also closed a gap on SAML authentication – if you’ve configured the Assistant to authenticate with Mobile Services via SAML, you can now also leverage the download metadata feature and don’t need to provide the metadata manually in most cases.
We’ve also changed how we ship the frameworks and tools – instead of having it all spread out in the folder structure of the DMG file, it is now embedded in the Assistant and you can from with-in the Assistant
- Export the frameworks to any location on your disk
- Install the tools in your /usr/local/bin
- Open the API docs
IMPORTANT: the frameworks are not duplicated anymore in the DMG folder structure; if you used to use automated scripts to copy frameworks into the right places, you now either need to manually export the frameworks once, or you let your scripts grab the frameworks out of package contents of the Assistant at /Contents/Resources/SAP-CP-SDK-for-iOS.
API Management Integration
It is now much easier to browse managed OData APIs and incorporate them into a native iOS App. Simply open the SAP API Business Hub or SAP API Management catalog, browse the available OData APIs there, and add them to your project.
The Assistant will automatically retrieve the API key if possible, configure Mobile Services with the right information to connect to the selected API, and then subsequently generate the OData proxy classes and UI scaffolding as usual.
Further reading on these features in these two excellent blogs
- API Business Hub Integration: https://blogs.sap.com/2017/10/27/sap-api-business-hub-integration-sap-cloud-platform-sdk-for-ios-2.0/
- API Management Dev Portal : https://blogs.sap.com/2017/11/07/from-api-to-app-assistant-tool-generates-mobile-app-scaffolding-from-a-backend-api/
Translation Hub Integration
Once you have worked on your app and want to get ready for rolling this out to a broader audience, you’ll inevitably start thinking about internationalization. This became as easy as it can get with the new Assistant, which extracts localizable text from your Xcode project, connects to SAP Translation Hub for translation, and then updates your Xcode project with the translated texts.
Simply open the context menu on an existing project in the Assistant, and choose “Add translation…”
Then select the target languages and let the machine do the job for you.
Note: Xcode doesn’t support using the script tools to import a new language into an Xcode project; so, the first time you run this you will see instructions on how to import then generated translation files yourself. You need to do this once – subsequent re-translations will run fully automatically and update the Xcode project automatically as well.
You can then also find the translation project on the Translation Hub site, and you can go there and fine-tune the translation where the tool didn’t find the appropriate translation for come phrases in the context of your app – simply follow to where the “Go to Translation Hub” button takes you.
More detail on this feature in a great blog at: https://blogs.sap.com/2017/10/27/sap-translation-integration-sap-cloud-platform-sdk-for-ios-2.0/
The generated App
We didn’t only clean up the Assistant UX, we’ve also spent significant effort on the generated App itself. We heard you saying that it wasn’t very easy to understand the structure of the generated code and to continue working on it and enhancing it. Check out the new way we’ve laid out the code now. We have dedicated storyboards and explicit classes per collection – it should be much easier to modify/enhance parts of the screens now, without messing up with everything else that you didn’t intend to touch at all.
The generated app also used the new on boarding flow implementation that we’re shipping in the new SAPFioriFlows framework (more details further below) – resulting in a very clean and secure implementation of the initial bootstrapping and authentication steps of an app.
One common ask from developers was that we should make it easier to implement the bootstrapping and initial user authentication of the app – also referred to as ‘onboarding’. Here you go – we are shipping a new framework SAPFioriFlows that holds more aggregated UI controls and flows, where we pull the UI controls of SAPFiori and the underlying features of SAPFoundation together and give ‘more complete’ implementations of recurring patterns. We stayed true to the principle that everything should be modular and extensible, though – you can freely assemble the on boarding by picking the right steps and orchestrating them into the flow that your app needs. You can also add custom steps if the SDK doesn’t ship just exactly what you need.
We covered quite a bit of functionality out of the box now; you can load configuration into your app from
- a hard-coded file that’s shipped with the app
- MDM provisioned configuration
- Discovery Service (email-based) configuration look-up
- QR code scanning
The users can authenticate with any of the mechanisms supported in SAPFoundation, including
- Basic Authentication
- SLS / Certificate
- One-time-password validation
Credentials in the app will be protected by
- TouchID, or
- application passcode
And all of that is implemented with UI controls following the SAP Fiori for iOS design patterns.
The easiest way of getting started on this new framework is to let the Assistant generate an App for you and have a look at the code in the Onboarding folder in the generated Xcode project. You also want to check out the API docs with all the sample code and suggestions that we’re giving in there.
We’ll look into enhancing this framework further, so keep the ideas coming what you most urgently need and don’t want to write yourself because you feel this is just so common and basic that everybody else will need it as well.
Added capabilities to existing Frameworks
On top of all of that, we continue to enhance the existing frameworks and capabilities based on what we hear from you developers using our stuff and helping us by identifying the gaps and weak-points of the SDK. Here’s what we got in stock for you with this 2.0 release – the full list is in our release notes.
SAPCommon / SAPFoundation
Authentication module enhancements
- OAuth Client Credential flow is supported now
- CSRF token handling is improved
- OTP handling is supported
- Implementation of Basic Auth and Client Certificate authentication becomes easier with new observers
- Support iOS 11 SFAuthenticatedSession
JSON Configuration Provider
Support for Swift 4 Codable
Capability to load user name and roles from Mobile Services
SAPOData / SAPOfflineOData
Support for service extensions; proxy classes will interoperate with older/newer versions of a service (if compatible)
Closed some gaps in OData v4 support
ILOdata enhancements to support batch operations, deep inserts, and binds
Improved transaction handling for offline OData
Make sure you update the SAP Fiori Mentor app to explore the new UI controls. Amongst others, they include these:
New header controls
New KPI controls
Initial set of Map controls
Shipping a Fiori Icon library now
Grid table view