Settings

public class Settings

This class stores the settings used in the memri app. Settings may include things like how to format dates, whether to show certain buttons by default, etc.

  • Shared settings that can be used from the main thread

    Declaration

    Swift

    static var shared: Settings
  • Init settings with the realm database

    Declaration

    Swift

    init()

    Parameters

    rlm

    realm database object

  • Get setting from path

    Declaration

    Swift

    public func get<T>(_ path: String, type _: T.Type = T.self) -> T? where T : Decodable

    Parameters

    path

    path of the setting

    Return Value

    setting value

  • get settings from path as String

    Declaration

    Swift

    public func getString(_ path: String) -> String

    Parameters

    path

    path of the setting

    Return Value

    setting value as String

  • get settings from path as Bool

    Declaration

    Swift

    public func getBool(_ path: String) -> Bool?

    Parameters

    path

    path of the setting

    Return Value

    setting value as Bool

  • get settings from path as Int

    Declaration

    Swift

    public func getInt(_ path: String) -> Int?

    Parameters

    path

    path of the setting

    Return Value

    setting value as Int

  • Sets the value of a setting for the given path. Also responsible for saving the setting to the permanent storage

    Declaration

    Swift

    public func set(_ path: String, _ value: Any)

    Parameters

    path

    path used to store the setting

    value

    setting value

  • get setting for given path

    Declaration

    Swift

    public func getSetting<T>(_ path: String, type: T.Type = T.self) throws -> T? where T : Decodable

    Parameters

    path

    path for the setting

    Return Value

    setting value

  • Get setting as String for given path

    Declaration

    Swift

    public func getSettingString(_ path: String) throws -> String

    Parameters

    path

    path for the setting

    Return Value

    setting value as String

  • Sets a setting to the value passed.Also responsible for saving the setting to the permanent storage

    Declaration

    Swift

    public func setSetting(_ path: String, _ value: AnyCodable) throws

    Parameters

    path

    path of the setting

    value

    setting Value

  • Undocumented

    Declaration

    Swift

    func addListener<T: Decodable>(
        _ path: String,
        _ id: UUID,
        type: T.Type = T.self,
        _ f: @escaping (Any?) -> Void
    ) throws
  • Undocumented

    Declaration

    Swift

    func removeListener(_ path: String, _ id: UUID)
  • Undocumented

    Declaration

    Swift

    func subscribe<T>(_ path: String, type: T.Type = T.self) -> SettingPublisher<T> where T : Decodable