SettingsKit

public protocol SettingsKit: CustomStringConvertible

Protocol for the SettingsKit enum

  • The identifier string for the Settings preference item

    Declaration

    Swift

    var identifier: String { get }
  • description Extension method

    String description of the enum value

    Declaration

    Swift

    public var description: String
  • get(_:) Extension method

    Fetch the current value for a given setting.

    Parameter

    Parameter setting: The setting to fetch

    Returns

    The current setting value

    Declaration

    Swift

    public static func get(setting: Self) -> AnyObject?

    Parameters

    setting

    The setting to fetch

    Return Value

    The current setting value

  • set(_:_:) Extension method

    Update the value of a given setting.

    • Parameters:
      • setting: The setting to update
      • value: The value to store for the setting

    Declaration

    Swift

    public static func set<T>(setting: Self, _ value: T)

    Parameters

    setting

    The setting to update

    value

    The value to store for the setting

  • subscribe(_:onChange:) Extension method

    Observe a given setting for changes. The onChange closure will be called, with the new setting value, whenever the setting value is changed either by the user, or progammatically.

    • Parameters:
      • setting: The setting to observe
      • onChange: The closure to call when the setting’s value is updated

    Declaration

    Swift

    public static func subscribe(setting: Self, onChange: SettingChangeHandler)

    Parameters

    setting

    The setting to observe

    onChange

    The closure to call when the setting’s value is updated