BFApp

public struct BFApp

This class adds some useful functions for the App.

  • Executes a block only if in DEBUG mode.

    More info on how to use it here.

    Declaration

    Swift

    public static func debug(_ block: () -> Void)

    Parameters

    block

    The block to be executed.

  • Executes a block only if NOT in DEBUG mode.

    More info on how to use it here.

    Declaration

    Swift

    public static func release(_ block: () -> Void)

    Parameters

    block

    The block to be executed.

  • If version is set returns if is first start for that version, otherwise returns if is first start of the App.

    Declaration

    Swift

    public static func isFirstStart(version: String = "") -> Bool

    Parameters

    version

    Version to be checked, you can use the variable BFApp.version to pass the current App version.

    Return Value

    Returns if is first start of the App or for custom version.

  • Executes a block on first start of the App, if version is set it will be for given version.

    Remember to execute UI instuctions on main thread.

    Declaration

    Swift

    public static func onFirstStart(version: String = "", block: (_ isFirstStart: Bool) -> Void)

    Parameters

    version

    Version to be checked, you can use the variable BFApp.version to pass the current App version.

    block

    The block to execute, returns isFirstStart.

  • Set the App setting for a given object and key. The file will be saved in the Library directory.

    Declaration

    Swift

    public static func setAppSetting(object: Any, forKey objectKey: String) -> Bool

    Parameters

    object

    Object to set.

    objectKey

    Key to set the object.

    Return Value

    Returns true if the operation was successful, otherwise false.

  • Get the App setting for a given key.

    Declaration

    Swift

    public static func getAppSetting(objectKey: String) -> Any?

    Parameters

    objectKey

    Key to get the object.

    Return Value

    Returns the object for the given key.