DefaultValueStorage
extension MoEngageStorage.DefaultValueStorage: MoEngageStorage.ReadOnlyLocation
where Wrapped: MoEngageStorage.ReadOnlyLocation,
Wrapped: MoEngageStorage.WriteOnlyLocation,
Wrapped.Stored == Default?,
Wrapped.Saved == Default?
extension MoEngageStorage.DefaultValueStorage: MoEngageStorage.WriteOnlyLocation
where Wrapped: MoEngageStorage.ReadOnlyLocation,
Wrapped: MoEngageStorage.WriteOnlyLocation,
Wrapped.Stored == Default?,
Wrapped.Saved == Default?,
Wrapped.Input == Void,
Wrapped.Output == Void
extension MoEngageStorage.DefaultValueStorage: MoEngageStorage.MigratableLocation
where Wrapped: MoEngageStorage.MigratableLocation
-
Reads the stored value, returning
defaultValue(sdkInstance)when the wrapped location is empty.If
saveDefaultistrueand the default is used, the default is written back to the wrapped location immediately so subsequent reads hit the fast path.Declaration
Swift
public func read( withInput input: Wrapped.Input, fromInstance sdkInstance: isolated MoEngageSDKInstance = #isolation ) throws(Wrapped.ReadError) -> DefaultParameters
inputUnused (
Void).sdkInstanceThe isolated SDK instance to read from (and write to when
saveDefaultistrue).Return Value
The stored value, or
defaultValue(sdkInstance)if absent.
-
Writes a value to the wrapped location.
Declaration
Swift
public func write( _ value: Default, toInstance sdkInstance: isolated MoEngageSDKInstance = #isolation ) throws(Wrapped.WriteError)Parameters
valueThe value to persist.
sdkInstanceThe isolated SDK instance to write to.
-
Removes the value from the wrapped location.
Declaration
Swift
public func remove( fromInstance sdkInstance: isolated MoEngageSDKInstance = #isolation ) throws(Wrapped.RemoveError)Parameters
sdkInstanceThe isolated SDK instance to remove from.