UnbluUIWindowConfiguration

public class UnbluUIWindowConfiguration

A class representing configuration properties for the main UnbluUIWindow (i.e. the UIWindow where Unblu content is displayed, such as the WebView).

A typical use case for this would be to create an instance and pass it to UnbluApiConfiguration before the API is initialised.

  • Creates an instance of the class

    Declaration

    Swift

    public init()
  • The background color of the Unblu UIWindow. Default value is UIColor.clear.

    Changing this value will change the background color of the Unblu UIWindow.

    Declaration

    Swift

    public var backgroundColor: UIColor { get set }
  • The normal window level for Unblu UI content. It’s default value is UIWindow.Level.normal + 10.

    When making updates to this property yourself, it is very important to keep in mind the other Unblu UI Window property maxCapturingLevel.

    • When you update windowLevel, maxCapturingLevel is updated automatically to remain at least +5 above, e.g: maxCapturingLevel = windowLevel + 5 For more information on the behaviour of maxCapturingLevel, see the property documentation.

    Declaration

    Swift

    public var windowLevel: UIWindow.Level { get set }
  • The maximum windowLevel that Unblu will capture during mobile cobrowsing. If you have other UIWindows in your application, their level must be lower or equal than maxCapturingLevel to be captured. There are also some prerequisites for capturing defined in the discussion below.

    In order for a UIWindow to be captured by Unblu, it’s windowLevel property must be satisfied by the following criteria:

    • The UIWindow can have a windowLevel of UIWindow.Level.statusBar
    • The UIWindow can have a windowLevel of UIWindow.Level.alert
    • If 1 of the previous 2 points are not satisfied, the UIWindow must have a windowLevel of at least UIWindow.Level.normal, and at most maxCapturingLevel.

    If you want to manage maxCapturingLevel yourself, please keep in mind the following important points:

    • maxCapturingLevel is automatically updated when you make changes to windowLevel.
    • To avoid any potential capturing problems, maxCapturingLevel must always be greater than windowLevel.
    • Always update windowLevel before maxCapturingLevel to ensure your changes are respected, e.g: windowLevel = UIWindow.Level.normal + 10 maxCapturingLevel = UIWindow.Level.normal + 11

    Declaration

    Swift

    public var maxCapturingLevel: UIWindow.Level { get set }
  • Use this property if you have a UIWindow set to the same windowLevel as UnbluUiWindow, i.e. windowLevel but you do not want this UIWindow to be captured during mobile cobrowsing.

    When a UIWindow is configured in this way, Unblu will replace your UIWindow with an overlay. This increases performance as the UI inside the UIWindow will not be traversed during mobile cobrowsing.

     let mainUiWindowConfiguration: UnbluUIWindowConfiguration = ...
    
     let uncapturedWindow = UIWindow()
     uncapturedWindow.windowLevel = mainUiWindowConfiguration.windowLevel
     // Set the tag property to UnbluUIWindow.windowTag to make sure this UIWindow is not captured by Unblu
     uncapturedWindow.tag = mainUiWindowConfiguration.windowTag
    

    Declaration

    Swift

    public let windowTag: Int
  • The supported orientations for the UnbluUIWindow. These orientations must be supported by your Xcode project. If not set, it defaults to what is configured in your Xcode project settings.

    Things to consider:

    • Depending on your specific setup, you may also need to set UIViewControllerBasedStatusBarAppearance to true in your Info.plist.
    • Passing a supported orientation in here that is NOT supported by your Xcode project, will not work.
    • For iPad support, your Xcode project must have “Requires full screen” enabled.

    Declaration

    Swift

    public var supportedOrientations: UIInterfaceOrientationMask?
  • When this is set to true, the WebView header will be expanded vertically to fill any empty space between the top of the WebView, and the top of the device screen. This works in unison with the uiTopMargin property. Additionally, when this is set to true touches will not propogate through the filled area to your UIWindow below. The default value is false.

    Declaration

    Swift

    public var expandHeaderToFillEmptySpace: Bool