Supporting Types
-
A wrapper on
See moreString, supportingUILabel-like properties fortext,fontandtextColor.Declaration
Swift
public class FUIText : FUITextProtocol, ExpressibleByStringLiteralextension FUIText: Initializable -
Subclass of UILabel, implementing
onChangeHandlerthat is invoked on changes to thevalueproperty.Theming
Base class paths:
fdlFUILabel {}Supported
Textattributes:
See morefont-color (Color) font-name (FontName) font-style (UIFontTextStyle) font-size (Number) text-align (TextAlign) text-line-clamp (Integer)Declaration
Swift
@MainActor open class FUILabel : UILabel, FUIContentCopyable -
FUIImageViewis an enhanced Fiori styleUIImageViewthat provides the option of applying a circular mask to the view’simageproperty. The view also exposes properties for specifying the width and color of an optional border around the image.The
contentModeof theFUIImageViewis set thescaleAspectFitby defaultRemark
Implements@IBDesignableUsage
- Initializing programmatically:
let imageView = FUIImageView(image: UIImage(named: "myProfilePic")) //set image view to be circular imageView.isCircular = true // To enable a default gradient layer behind the placehoder text imageView.isGradientLayerEnabled = true // Set placeholder text imageView.placeholder.text = "This is a placehoder" // Set placeholder background color imageView.placeholderBackgroundColor = UIColor.white- Placing inside a Storyboard or xib:
- Drag and drop an
UIImageViewcomponent to Interface Builder canvas. - Switch class name from
UIImageViewtoFUIImageView', and set module toSAPFiori`. - To apply, set
@IBInspectablepropertyisCircular, totrue
Declaration
Swift
@IBDesignable @MainActor open class FUIImageView : UIImageView, FUIObservableValue, InnerViewContainerextension FUIImageView: FUIGlyphImageextension FUIImageView: FUIAttributedGlyphImage -
The
See moreFUITextViewclass extendsUITextView, to support displaying a styled placeholder text string when thetextproperty is empty.Declaration
-
Subclass of
UITextField, which implements theFUIObservableValueprotocol, to observe changes to thetextproperty. TheonChangeHandler: ((String?) -> Void)?closure will be invoked on changes to thetextproperty.Theming
Supported style classes
See morefdlFUITextField fdlFUITextField_clearButton fdlFUITextField_secureShowButton fdlFUITextField_secureHideButtonDeclaration
Swift
@MainActor open class FUITextField : UITextField, FUIObservableValue -
Subclass of
See moreFUITextField, which supports auto-resizing the text field width based on the text entered.Declaration
Swift
@MainActor public class FUIAutoResizingTextField : FUITextField -
This
FUINavigationControlleris needed for iOS 13.4 and above devices to control the status bar style used by SAPFiori UI components.Note that before iOS 13.4, it is recommended to use an extension of
UINavigationControllerin the application to override thepreferredStatusBarStyle, as documented inFUIStatusBarStyleHelper‘s header doc. However, it does not work for iOS 13.4 and later iOS versions. Developers need to use thisFUINavigationControllerwhich overrides thepreferredStatusBarStyleproperty of standardUINavigationControllerin order for thepreferredStatusBarStyleto be invoked for iOS 13.4 and above.The application should use
FUINavigationControllerinstead of standardUINavigationControllerwhen displaying SAPFiori UI components in order for the correct status bar style to be displayed. This functionality is achieved in cooperation withFUIStatusBarStyleHelper.Application developers can also use
FUINavigationControllerin the launch storyboard so that it can useFUIStatusBarStyleHelperto set the application’s status bar style as needed in other application views as well.Declaration
Swift
@available(*, deprecated, message: "No longer supported. Please use UINavigationController.") @MainActor open class FUINavigationController : UINavigationController -
FUINavigationBaris a subclass of ‘UINavigationBar’ which applies the Fiori Design Language styling by default.It exposes a
bannerView: FUIBannerMessageViewview property, which may be presented, using theFUIBannerMessageViewshow()method. By default, the message is shown centered on screen under the navigation bar.Usage
Configuration
Setup a
FUINavigationBarin your navigation controller. You can set either in storyboard or programmatically.Presenting
FUIBannerMessageViewguard let navBar = self.navigationController?.navigationBar as? FUINavigationBar else { return } navBar.bannerView?.show(message: "This is a test banner", withDuration: 1, animated: true)Theming
bar-tint-coloris intended to be used for backward compatibility on iOS 12. In order to customize navigation bar color on iOS 13 or above, developer should either setbackground-colorto apply one color to all bar appearences, or configurestandard-background-color,scrolledge-background-colorandscrolledge--background-coloras a whole for different color settings.
See moreNavigationBar { background-color: @primary1_darkBackground; background-tint-color: @tintColorDark; }Declaration
Swift
@IBDesignable @MainActor open class FUINavigationBar : UINavigationBar -
Subclass of
UIButton, which provides for rounded edge and rounded fill styles. It also provides for per-state tint colors, persistent selection, and a closure-styled tap handler.The
FUIButtonimplements the Fiori Design Language in default configuration.# Usage
## Initialization
Init button with expected style (for default, use
.tertiary).To use
FUIButtonstyle variants in Interface Builder, the convenience subclassesFUIRoundedButton(.tertiary) andFUIRoundedFillButton(.primary) are also available.// init with expected style. let normalButton = FUIButton() // equivalent to FUIButton(style: .tertiary) let roundedOutlineButton = FUIButton(style: .secondary) // equivalent to `FUIRoundedButton()` let roundedFilledButton = FUIButton(style: .primary) // equivalent to `FUIRoundedFillButton()`## Setting button style and semantic attribute There are three button styles supported: primary, secondary, and tertiary. You can also configure the semantic attribute (normal, tint, negative) for the button.
button.style = .primary button.semantic = .negative## Setting title(s)
UIButtonprovides two techniques for setting its title:setTitle(_:, for:)titleLabel.text
The behavior of the (2) is inconsistent, and discouraged by Apple. As a result,
titleLabel.textshould be avoided in favor of techniquesetTitle(_:_:). TheFUIButtonwill correct the behavior oftitleLabel.text, ifsetTitle(_:_:)is not used. However, if the developer at any point invokessetTitle(_:, for:)directly,FUIButtonwill cease to correct fortitleLabel.text, and will defer to the developer to use the API correctly.button.setTitle("Follow", for: .normal) button.setTitle("Unfollow", for: .selected)## Specify Selection Behavior The default behavior of
UIButtonis to toggle between.normaland.highlightedUIControlState, on user touches started and touches ended. The.selectedstate is never used.FUIButtonsupports toggling between.normaland.selectedUIControlState, by setting theisPersistentSelectionflag totrue. This is particularly useful, if using the button to toggle a property. The developer may use theisSelected: BoolAPI to toggle cause this transition.button.isPersistentSelection = true // causes button to toggle between `.normal` and `.selected` states on user touchWhen
isPersistentSelection == true, the button may transition briefly through the.highlightedstate, between.selectedand.normalon user touches. Configure settings for[.selected, .highlighted], if implementing custom behavior here.## Color Configuration In any style, you may choose to override the background color for state, which is useful for applying an inverted style.
button.setBackgroundColor(UIColor.preferredFioriColor(forStyle: .tintColorLight), for: .highlighted)In any style, you may choose to override the title color for state, which is useful for applying an inverted style.
button.setTitleColor(UIColor.preferredFioriColor(forStyle: .header), for: .normal)You can set whether the border color is applied based on
UIControlStatebutton.setIsApplyingBorderColor(true, for: .normal)The
FUIButtonalso implements theFUIBackgroundSchemeSupportingprotocol, which enables developers to inform the control whether it is being presented against a ‘light’ background, or ‘dark’ background. The default style of the button will adapt to the background color scheme; defaults to.light.## Size Calculation The
FUIButtoncalculates anintrinsicContentSizefrom itsimageViewandtitleLabel, its various insets, and itsdirectionalLayoutMargins.To manage the width of the text in the
titleLabel, use the regularUILabelAPI to configure the wrapping behavior.button.titleLabel?.preferredMaxLayoutWidth = 200 button.titleLabel?.lineBreakMode = .byWordWrappingAs an additional configuration option, the
FUIButtonprovides a flagisPreservingPreferredMaxLayoutWidth, which uses thepreferredMaxLayoutWidthas a minimum width for thetitleLabelwhen calculatingintrinsicContentSize. This is useful, when implementing a fixed-width button with variable texts, or toggling variable-width texts on state.Note
This will not affect the
titleLabeltext wrapping behavior.button.isPreservingPreferredMaxLayoutWidth = true## Selection handler: Optional closure-based substitute for
addTarget(_:_:_:)method for handling user taps. Passesselfas input parameter. Is compatible withaddTarget(_:_:_:)selector registration.If used in combination with the target-action selector registration, handlers will be invoked in the following order:
didSelectHandler- target-action selector
## custom configuration configurationUpdateHandler can be used to do custom configuration:
button.configurationUpdateHandler = { [unowned self] button in var configuration = UIButton.Configuration.plain() if let currentConfig = button.configuration { configuration = currentConfig } var container = AttributeContainer() container.font = UIFont.preferredFioriFont(forTextStyle: .headline, weight: .semibold) // named color(like .red, .blue, etc) not working for foregroundColor, backgroundColor on AttributeContainer, you can use fioriColor, hexStringColor, RGB Color, or System Color instead. container.foregroundColor = .preferredFioriColor(forStyle: .tintColor) configuration.attributedTitle = AttributedString("FUIButton", attributes: container) configuration.imagePadding = 10 configuration.showsActivityIndicator = true configuration.activityIndicatorColorTransformer = UIConfigurationColorTransformer({ _ in return .red }) configuration.image = FUIIconLibrary.actions.actionSettingsFill configuration.imageColorTransformer = UIConfigurationColorTransformer({ [unowned self] color in return button.titleColor(for: button.state) ?? .white }) configuration.imagePlacement = .trailing // set customized contentInsets here configuration.contentInsets = NSDirectionalEdgeInsets(top: 20, leading: 40, bottom: 20, trailing: 40) // configuration must be reset to be effective. button.configuration = configuration }When
configurationis assigned for the first time or assigned to nil, the following settings will be reset to SDK’s default values: titleLabel?.font = UIFont.preferredFioriFont(forTextStyle: .body, weight: .semibold) titleLabel?.lineBreakMode = .byWordWrapping titleLabel?.textAlignment = .center titleLabel?.numberOfLines = 0 imageView?.contentMode = .scaleAspectFitWhen
configurationis assigned to nil, application should callsetNeedsUpdateConfiguration. Otherwise, the button layout will not be refreshed.When using UIButtonConfiguration, the properties (include contentEdgeInsets, titleEdgeInsets, imageEdgeInsets, adjustsImageWhenHighlighted and adjustsImageWhenDisabled) are ignored, please use configuration.contentInsets to do contentInsets customization.
## Theming
Support
Buttonclass paths:Button {} fdlFUIButton {}
Supported
Buttonattributes:tint-color { -selected | -highlighted | -selected-highlighted | -selected-disabled | -disabled } (Color) background-color { -normal | -selected | -highlighted | -selected-highlighted | -selected-disabled | -disabled } { -primary| -secondary| -tertiary } (Color) background-image { -selected | -highlighted | -selected-highlighted | -selected-disabled | -disabled } (Image) content-insets (Box) image-insets (Box) title-insets (Box) shadow-color (Color) shadow-offset (Offset) shadow-opacity (Number) shadow-radius (Number)
Supported
Textattributes:font-color { -selected | -highlighted | -selected-highlighted | -selected-disabled | -disabled } (Color) font-name (FontName) font-style (UIFontTextStyle) font-size (Number) text-align (TextAlign) text-alpha (Number) text-auto-fit (Boolean) text-line-clamp (Integer) text-shadow-color { -selected | -highlighted | -selected-highlighted | -selected-disabled | -disabled } (Color) text-shadow-offset (Offset)
Supported
ImageViewattributes:image { -highlighted | -selected | -selected-highlightecd | -selected-disabled | -disabled } (Image)
See moreRemark
Thetint-color { -* }attribute will override thefont-color { -* }attribute on a state-by-state basis. E.g.tint-color-highlightedwill overridefont-color-highlighted, but will not affectfont-color.Declaration
Swift
@MainActor open class FUIButton : UIButton, FUIButtonClosureHandling, FUIStateSelectable, FUIBackgroundSchemeSupporting, PrepareForReuse -
Convenience subclass of
FUIButtonimplementingFUIButtonStyle.secondary( previousFUIButtonStyle.fuiRoundedin 7.0 release ), for use in Interface Builder.Declaration
Swift
@MainActor open class FUIRoundedButton : FUIButton -
Convenience subclass of
FUIButtonimplementingFUIButtonStyle.primary( previousFUIButtonStyle.fuiRoundedFilledin 7.0 release), for use in Interface Builder.Declaration
Swift
@MainActor open class FUIRoundedFillButton : FUIButton -
FUITagdisplayed as a tag withinFUIObjectHeaderView,FUIMapDetailTagObjectTableViewCellandFUITagView.Usage
- Initializing programmatically:
See morelet tag = FUITag(title: "Tag1")Declaration
Swift
public class FUITag : FUITagText -
FUITextdisplayed as a tag withinFUIObjectHeaderViewandFUIMapDetailTagObjectTableViewCell.Available:
contentInsets: The contentInsets between the tag border and tag contentcornerRadius: The corner radius around the tagfillColor: UIColor inside the tagborderColor: UIColor around the perimeter of the tag
Initialization and Configuration
See morelet tag = FUITagText("Tag") tag.borderColor = borderColor tag.fillColor = fillColor tag.textColor = textColor tag.font = fontDeclaration
Swift
public class FUITagText : FUIText -
A protocol defines the properties that a view supporting validation should have.
See moreDeclaration
Swift
public protocol FUIInlineValidation -
Simple enumeration for horizontal alignment styles
- left: left-aligned
- center: center-aligned
- right: right-aligned
Declaration
Swift
public enum FUIHorizontalAlignment -
A protocol for use in
See moreFUIImageViewandFUIAttributedGlyphImageDeclaration
Swift
public protocol FUIGlyphImage -
A class that implements
See moreFUIAttributedGlyphImageprotocolDeclaration
Swift
public class FUIAttributedImage : FUIAttributedGlyphImage -
A protocol that adds further requirements to FUIGlyphImage
See moreDeclaration
Swift
public protocol FUIAttributedGlyphImage : FUIGlyphImage -
FUIPlaceholderImageViewis a variant ofFUIImageView. Placeholder text can be shown if there is no image set.Typically not used directly by developer.
Theming
Supported class paths:
fdlFUIPlaceholderImageView_placeholder {}
Supported properties:
font-color: Color; font-style: UIFontTextStyle; text-line-clamp: Integer; text-align: NSTextAlignment;
Declaration
Swift
@available(*, deprecated, message: "This has been integrated with FUIImageView, please use that instead") @MainActor open class FUIPlaceholderImageView : FUIImageView -
Placeholder view component of
FUIPlaceholderImageView.Typically not used directly by developer.
Theming
Supported class paths:
fdlFUIPlaceholderView_placeholder {}
Supported properties:
font-color: Color; font-style: UIFontTextStyle; text-line-clamp: Integer; text-align: NSTextAlignment;
See moreDeclaration
Swift
@MainActor public class FUIPlaceholderView : FUIDrawingView, FUIPlaceholderComponent -
Special case of FUILabel, used for maintaining backwards compatiblity in controls which were originally developed by laying-out several
FUILabelinstances, but which have been now been transitioned to anNSAttributedStringDrawinglayout technique, in which the contents of several string properties are concatenated intoNSAttributedStrings and laid-out usingNSParagraphStyleconfigurations (e.g. FUIObjectTableViewCell).The
FUILabelProxymay be used by the developer for supplying configurations and text, but will not be laid-out in the parent view. Its configurations and content will be read by aNSAttributedStringconcatenation engine.See API and Theming header-doc for
FUILabelRemark
Should not be used directly by app developer. UseFUILabel, instead.Declaration
Swift
@MainActor final public class FUILabelProxy : FUILabel -
A simple UIView subclass to take email address as input.
Theming
Supported style classes
See morefdlFUIEmailInputView fdlFUIEmailInputView_emailTextField fdlFUIEmailInputView_bottomBorderViewDeclaration
Swift
@MainActor public class FUIEmailInputView : NibDesignable, UITextFieldDelegate -
This structure describes one input field for user input in the
See moreFUIDynamicAuthenticationScreen.Declaration
Swift
public struct FUIAuthenticationInformationField