SAP BTP SDK for iOS distributes binary frameworks as Swift Package

This blog post teaches you how to obtain the SAP BTP SDK for iOS binary frameworks (.xcframework) through Swift Package Manager (SPM).

I will also give an overview of existing alternatives.

Swift Package Manager (SPM)

Swift Package Manager is a decentralized dependency manager for Swift projects and is a first-class citizen in the Apple ecosystem.

All binary frameworks, starting from 6.1.15 and 7.0.3, can be consumed with Swift Package https://github.com/SAP/cloud-sdk-ios through Apple’s Swift Package Manager (SPM):

  • SAPCommon
  • SAPFoundation
  • SAPFiori
  • SAPFioriFlows
  • SAPOData
  • SAPOfflineOData
  • SAPML

The SDK binaries are hosted in SAP’s Internet-facing repository, which requires authenticated access. You must visit the Technical Users’ UI Home Page to obtain a technical username/password.

Then add an entry to your .netrc file as follows:

machine rbsc.repositories.cloud.sap login sap-xxxxxx password xxxxxxxxxxxxxxxxxx

In Xcode you can add the Swift Package to your project by navigating to File > Add Packages... >. Use the Search or Enter Package URL field to find the package using the repository URL https://github.com/SAP/cloud-sdk-ios.

You can choose multiple of the following package products to be added to your application/framework target.

Add Frameworks to your application/framework target

For detailed information, please review the README file.

SPM Tips

I recommend using version requirement “Up to Next Minor” so ensure that you get patch releases when clicking “Update to Latest Package Versions” in Xcode.

Choose%20Version%20Requirement

Choose Version Requirement

If you are using GitHub actions then action-xcodeproj-spm-update might interest you. This action will resolve the Swift Package Manager dependencies within your Xcode project. This can be useful in workflows that want to detect outdated dependencies, or wish to automatically create pull requests updating dependencies.

CocoaPods

CocoaPods is a centralized dependency manager for Swift and Objective-C Cocoa projects.

GitHub repository https://github.com/SAP-samples/cloud-sdk-ios-specs hosts the .podspec files. Credentials are required to download the binary frameworks analog to the distribution through Swift Package Manager.

For detailed information, please review the README file.

SAP BTP SDK Assistant for iOS

The macOS application acts as the central entry point for creating and managing scenario-based applications that implement SDK features, providing SAP Mobile Services integration, and supporting other features, such as API and translation services.

The Assistant automatically adds the binary frameworks to the generated Xcode project.

If you want direct access to the SDK frameworks, open the Assistant’s main menu, select Export Frameworks, and choose the desired location on your disk.

Export%20Frameworks

Export Frameworks