Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
MarcoEidinger
Product and Topic Expert
Product and Topic Expert
Hi,

SAP Fiori Mentor app, as interactive documentation to discover and view live previews of all UI components, is pretty neat. As a designer or developer, you can easily change parameters and see the effect immediately.

But is it possible to get such preview functionality for your own UI-Kit based components built on top of SAP Cloud Platform SDK for iOS?

Yes ? ? ! This blog post will give you an example.

Xcode Previews was added in Xcode 11 and allow you to quickly preview the current state of your view. You might think that you need to use SwiftUI in production to make use of this feature but it’s not true.

Whether you’re working with a custom UIView or with a custom UIViewController, they both support previews in the new canvas.

In the example illustrated below, we are previewing a custom subclass of FUIObjectTableViewCell


Demo how to use Xcode Previews with SAP CP SDK for iOS


Here is the example code

Side note: if you are interested in how SAP Cloud Platform SDK for iOS is adopting SwiftUI then have a look at the new open-source project https://github.com/SAP/cloud-sdk-ios-fiori. This project is meant to augment and in some cases replace the UIKit-based implementation contained in the SAPFiori framework. This project is in development, and should not yet be used productively.