FUIWelcomeScreen

public class FUIWelcomeScreen: UIViewController

This UIViewController is used to display a welcome/launch screen to the application for onboarding. The screen mainly displays the application name, instructions on how to start the activation process and an option to trigger the demo mode of the application. There are two versions of the launch screen. Version 1 does not have sign in. Version 2 has a sign in with an additional Activate button for activation process.

FUIWelcomeScreen

Application can implement the FUIOnboardingDelegate protocol, to present the demo mode of the application by adopting with the didSelectDemoMode function and to proceed sign in by implementing the didSelectSignIn function

FUIWelcomeScreen is implemented in FUIWelcomeScreen.storyboard. There are two ways to launch the screen:

  • Use another story board and use a Present Modally segue to FUIWelcomeScreen storyboard in SAPFiori framework with com.sap.cp.sdk.ios.SAPFiori as Bundle. App programmer needs to provide the properties needed in UIController’s prepare for segue function:

 override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    let vc = segue.destination as! FUIWelcomeScreen
    vc.state = .isConfigured    //shows version2 of the launch screen
    //without calling vc.view.layoutSubviews(), components are not initialized. For example, vc.welcomeDetailLabel is still nil.
    vc.view.layoutSubviews()
    vc.welcomeDetailLabel.text = "Thank you for downloading SAP Project Companion for Managers."
    vc.delegate = self
 }

  • Programmatically loads it:

 let vc = FUIWelcomeScreen.createInstanceFromStoryboard()
 vc.state = .isConfigured  // shows version2 of the launch screen
 vc.welcomeDetailLabel.text = "Thank you for downloading SAP Project Companion for Managers."
 self.navigationController?.pushViewController(vc, animated: true)

Note that the FUIWelcomeScreen is supported for iPad portrait and landscape orientation and iPhone portrait orientation only. Since the screen is not supported in iPhone landscape orientation, the app needs to switch to portrait mode before presenting the screen. And AppDelegate needs to lock the screen orientation when these screens are shown, similar to the following code snippet.

In app’s AppDelegate:


 public var inFUIWelcomeScreen: Bool = false

 // implement this function to support only portrait orientation when FUIWelcomeScreen is displayed in iPhone.
 func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
     if !inFUIWelcomeScreen {
         return .allButUpsideDown
    } else {
        return .portrait
    }
 }

Before presenting the FUIWelcomeScreen:


 // Let AppDelegate know that we are entering the screen
 (UIApplication.shared.delegate as! AppDelegate).inFUIWelcomeScreen = true

 // Make sure we rotate to portrait mode
 let value = UIInterfaceOrientation.portrait.rawValue
 UIDevice.current.setValue(value, forKey: "orientation")

 // Present the screen
 let vc = FUIWelcomeScreen.createInstanceFromStoryboard()
 vc.welcomeDetailLabel.text = "Thank you for downloading SAP Project Companion for Managers."
 self.navigationController?.pushViewController(vc, animated: true)

After dismissing the Passcode or Touch ID screen:


 onboardingScreen.dismiss(animated: true, completion: nil)

 // Let AppDelegate know that we are exiting the view
 (UIApplication.shared.delegate as! AppDelegate).inFUIWelcomeScreen = false

  • Creates a FUIWelcomeScreen object from storyboard and intitialize subview compoennts.

    Declaration

    Swift

    public class func createInstanceFromStoryboard() -> FUIWelcomeScreen

    Return Value

    A FUIWelcomeScreen object.

  • Welcome detail label. Setting welcomeDetailLabel.text displays the welcome detail message on the screen. Framework does not display any default text.

    Declaration

    Swift

    @IBOutlet public var welcomeDetailLabel: UILabel!
  • Welcome label. Setting welcomeLabel.text displays the welcome text on the screen; otherwise, framework displays the default text.

    Declaration

    Swift

    @IBOutlet public var welcomeLabel: UILabel!
  • Instruction text view. Setting instructionTextView.text displays the instruction statement on the screen; otherwise, framework displays the default text.

    Declaration

    Swift

    @IBOutlet public var instructionTextView: UITextView!
  • Activate button that only shows when state is set to .isConfigured. Setting signInButton.setTitle displays your own title for the button on the screen; otherwise, framework displays the default title, Activate.

    Declaration

    Swift

    @IBOutlet public var signInButton: FUIOnboardingButton!
  • Demo label. Setting demoLabel.text displays the demo message on the screen; otherwise, framework displays the default text.

    Declaration

    Swift

    @IBOutlet public var demoLabel: UILabel!
  • Demo button. Setting demoButton.setTitle displays your own title on the screen; otherwise, framework displays the default title.

    Declaration

    Swift

    @IBOutlet public var demoButton: FUIOnboardingButton!
  • The FUIOnboardingDelegate implementation.

    Declaration

    Swift

    public weak var delegate: FUIOnboardingDelegate? = nil
  • A flag to indicate demo availability. Default is true. Only when it’s true, display Want to explore label and Try the Demo button.

    Declaration

    Swift

    public var isDemoAvailable: Bool = true
  • A property to indicate the state in the onboarding process. Setting this property can show either version 1 or version 2 of the screen. Default is .notConfigured to show version 1. Only when it is .isConfigured, display Activate button for version 2.

    Declaration

    Swift

    public var state: FUIOnboardingState = .notConfigured