NUISettings

public class NUISettings: NSObject

The style class settings class that provides a list of static functions for applying-style-related functionalities

  • The NUISettings instance

    Declaration

    Swift

    public static var instance: NUISettings!
  • Apply a specific stylesheet for theming with an given style sheet file name

    Declaration

    Swift

    public static func initWithStylesheet(name: String)

    Parameters

    name

    The style sheet file name

  • Append a specific stylesheet for theming with an given style sheet file name

    Declaration

    Swift

    public static func appendStylesheet(name: String)

    Parameters

    name

    The style sheet file name

  • Load a specific stylesheet for theming with an given full style sheet path

    Declaration

    Swift

    public static func loadStylesheetByPath(path: String)

    Parameters

    path

    The style sheet file full path

  • Load a specific stylesheet for theming with an given URL to the style sheet

    Declaration

    Swift

    public static func loadStylesheetByURL(url: URL)

    Parameters

    url

    The URL to the style sheet

  • Load all the style sheets set in initWithStylesheet and appendStylesheet

    Declaration

    Swift

    public static func reloadStylesheets()
  • Reload a specific stylesheet on orientation changes

    Declaration

    Swift

    public static func reloadStylesheetsOnOrientationChange(orientation: UIInterfaceOrientation) -> Bool

    Parameters

    orientation

    The UIInterfaceOrientation changed

    Return Value

    true if orientation is changed and style sheet gets reloaded; otherwise, false

  • Check to see if auto update of the style sheet is enabled by checking if autoUpdatePath is set

    Declaration

    Swift

    public static func autoUpdateIsEnabled() -> Bool

    Return Value

    true if autoUpdatePath is set

  • Get the style sheet path for auto update

    Declaration

    Swift

    public static func autoUpdatePath() -> String?

    Return Value

    The path for auto updated style sheet

  • Set the auto update path for style sheet

    Declaration

    Swift

    public static func setAutoUpdatePath(path: String)

    Parameters

    path

    The path

  • Look for a given property in a given explicit style class.

    Declaration

    Swift

    public static func hasProperty(property: String, withExplicitClass className: String) -> Bool

    Parameters

    property

    The targeted property to be searched in the style class

    className

    The explicit style class

    Return Value

    true if found; otherwise, false

  • Look for a given property in a given style class(es).

    Declaration

    Swift

    public static func hasProperty(property: String, withClass className: String) -> Bool

    Parameters

    property

    The targeted property to be searched in the style class(es)

    className

    The targeted style class(es), which may contain more than one style class with “:” as separator

    Return Value

    true if found; otherwise, false

  • Look for font property in a given style class

    Declaration

    Swift

    public static func hasFontPropertiesWithClass(className: String) -> Bool

    Parameters

    className

    The given style class

    Return Value

    true if found; otherwise, false

  • Get a given property’s String value in a given style class.

    Declaration

    Swift

    public static func get(property: String, withExplicitClass className: String) -> String?

    Parameters

    property

    The targeted property to be searched in the style class.

    withExplicitClass

    The targeted style class.

    Return Value

    The property String value if found; otherwise, nil.

  • Get a given property’s value in a given style class(es).

    Declaration

    Swift

    public static func get(property: String, withClass className: String) -> String?

    Parameters

    property

    The targeted property to be searched in the style class(es)

    className

    The targeted style class(es), which may contain more than one style class with “:” as separator

    Return Value

    The property value if found; otherwise, nil.

  • Get a given property’s Bool value in a given style class.

    Declaration

    Swift

    public static func getBoolean(property: String, withClass className: String) -> Bool

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property Bool valuei f found; otherwise, nil.

  • Get a given property’s Float value in a given style class.

    Declaration

    Swift

    public static func getFloat(property: String, withClass className: String) -> Float?

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property Float value if found; otherwise, nil.

  • Get a given property’s Int value in a given style class.

    Declaration

    Swift

    public static func getInteger(property: String, withClass className: String) -> Int?

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property Int value if found; otherwise, nil.

  • Get a given property’s CGSize value in a given style class.

    Declaration

    Swift

    public static func getSize(property: String, withClass className: String) -> CGSize?

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property CGSize value if found; otherwise, nil

  • Get a given property’s UIOffset value in a given style class.

    Declaration

    Swift

    public static func getOffset(property: String, withClass className: String) -> UIOffset?

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UIOffset value if found; otherwise, nil.

  • Get a given property’s UIEdgeInsets value in a given style class.

    Declaration

    Swift

    public static func getEdgeInsets(property: String, withClass className: String) -> UIEdgeInsets?

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UIEdgeInsets value if found; otherwise, nil.

  • Get a given property’s UITextBorderStyle value in a given style class.

    Declaration

    Swift

    public static func getBorderStyle(property: String, withClass className: String) -> UITextBorderStyle

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UITextBorderStyle value if found; otherwise, UITextBorderStyle.none.

  • Get a given property’s UITableViewCellSeparatorStyle value in a given style class.

    Declaration

    Swift

    public static func getSeparatorStyle(property: String, withClass className: String) -> UITableViewCellSeparatorStyle

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UITableViewCellSeparatorStyle value if found; otherwise, UITableViewCellSeparatorStyle.none.

  • Get UIFont value in a given style class.

    Declaration

    Swift

    public static func getFontWithClass(className: String) -> UIFont?

    Parameters

    className

    The targeted style class.

    Return Value

    The property UIFont value if found; otherwise, UIFont.systemFontSize.

  • Get UIFont value in a given style class and a given base UIFont

    Declaration

    Swift

    public static func getFontWithClass(className: String, baseFont: UIFont?) -> UIFont

    Parameters

    className

    The targeted style class.

    Return Value

    The property UIFont value if found; otherwise, baseFont with size set to UIFont.systemFontSize.

  • Get a given property’s UIColor value in a given style class.

    Declaration

    Swift

    public static func getColor(property: String, withClass className: String) -> UIColor?

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UIColor value if found; otherwise, nil.

  • Get a given image property’s UIColor value in a given style class.

    Declaration

    Swift

    public static func getColorFromImage(property: String, withClass className: String) -> UIColor?

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UIColor value if found; otherwise, nil.

  • Get a given color property’s UIImage value in a given style class.

    Declaration

    Swift

    public static func getImageFromColor(property: String, withClass className: String) -> UIImage?

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UIImage value if found; otherwise, nil.

  • Get a given property’s UIImage value in a given style class.

    Declaration

    Swift

    public static func getImage(property: String, withClass className: String) -> UIImage?

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UIImage value if found; otherwise, nil.

  • Get a given property’s UIBarStyle value in a given style class.

    Declaration

    Swift

    public static func getBarStyle(property: String, withClass className: String) -> UIBarStyle

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UIBarStyle value if found; otherwise, UIBarStyle.default.

  • Get a given property’s NSTextAlignment value in a given style class.

    Declaration

    Swift

    public static func getTextAlignment(property: String, withClass className: String) -> NSTextAlignment

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property NSTextAlignment value if found; otherwise, NSTextAlignment.left.

  • Get a given property’s UIControlContentHorizontalAlignment value in a given style class.

    Declaration

    Swift

    public static func getControlContentHorizontalAlignment(
            property: String, withClass className: String) -> UIControlContentHorizontalAlignment

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UIControlContentHorizontalAlignment value if found; otherwise, UIControlContentHorizontalAlignment.left.

  • Get a given property’s UIControlContentVerticalAlignment value in a given style class.

    Declaration

    Swift

    public static func getControlContentVerticalAlignment(
            property: String, withClass className: String) -> UIControlContentVerticalAlignment

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UIControlContentHorizontalAlignment value if found; otherwise, UIControlContentVerticalAlignment.top.

  • Get a given property’s UIKeyboardAppearance value in a given style class.

    Declaration

    Swift

    public static func getKeyboardAppearance(property: String, withClass className: String) -> UIKeyboardAppearance

    Parameters

    property

    The targeted property to be searched in the style class.

    className

    The targeted style class.

    Return Value

    The property UIKeyboardAppearance value if found; otherwise, UIKeyboardAppearance.default.

  • Convert a list of style classes in a String to an array

    Declaration

    Swift

    public static func getClasses(className: String) -> [String]

    Parameters

    className

    The String which contains a list of style classes with “:” as the separator

    Return Value

    The String array that contains the style classes. Each item in the array has one style class.

  • Set a list of views to be excluded in applying the style

    Declaration

    Swift

    public static func setGlobalExclusions(array: [String])

    Parameters

    array

    The String array that contains a list of excluded views

  • Get a list of views to be excluded in applying the style

    Declaration

    Swift

    public static func getGlobalExclusions() -> [String]

    Return Value

    The String array that contains a list of excluded views

  • Get style sheet orientation name

    Declaration

    Swift

    public static func stylesheetOrientation() -> String?

    Return Value

    “landscape” or “portrait”

  • Get style sheet orientation name based on a given UIInterfaceOrientation

    Declaration

    Swift

    public static func stylesheetOrientationFromInterfaceOrientation(orientation: UIInterfaceOrientation) -> String

    Parameters

    orientation

    The UIInterfaceOrientation to be determined

    Return Value

    “landscape” if the given orientation is landscape; otherwise, “portrait”.

  • Get the global NUISettings instance

    Declaration

    Swift

    public static func getInstance() -> NUISettings