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
rlmrealm database object
-
Get setting from path
Declaration
Swift
public func get<T>(_ path: String, type _: T.Type = T.self) -> T? where T : DecodableParameters
pathpath of the setting
Return Value
setting value
-
get settings from path as String
Declaration
Swift
public func getString(_ path: String) -> StringParameters
pathpath of the setting
Return Value
setting value as String
-
get settings from path as Bool
Declaration
Swift
public func getBool(_ path: String) -> Bool?Parameters
pathpath of the setting
Return Value
setting value as Bool
-
get settings from path as Int
Declaration
Swift
public func getInt(_ path: String) -> Int?Parameters
pathpath 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
pathpath used to store the setting
valuesetting value
-
get setting for given path
Declaration
Swift
public func getSetting<T>(_ path: String, type: T.Type = T.self) throws -> T? where T : DecodableParameters
pathpath for the setting
Return Value
setting value
-
Get setting as String for given path
Declaration
Swift
public func getSettingString(_ path: String) throws -> StringParameters
pathpath 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) throwsParameters
pathpath of the setting
valuesetting 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
Settings Class Reference