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

Available where Wrapped: MoEngageStorage.ReadOnlyLocation, Wrapped: MoEngageStorage.WriteOnlyLocation, Wrapped.Stored == Default?, Wrapped.Saved == Default?

  • Reads the stored value, returning defaultValue(sdkInstance) when the wrapped location is empty.

    If saveDefault is true and 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) -> Default

    Parameters

    input

    Unused (Void).

    sdkInstance

    The isolated SDK instance to read from (and write to when saveDefault is true).

    Return Value

    The stored value, or defaultValue(sdkInstance) if absent.

Available where Wrapped: MoEngageStorage.ReadOnlyLocation, Wrapped: MoEngageStorage.WriteOnlyLocation, Wrapped.Stored == Default?, Wrapped.Saved == Default?, Wrapped.Input == Void, Wrapped.Output == Void

  • Writes a value to the wrapped location.

    Declaration

    Swift

    public func write(
        _ value: Default,
        toInstance sdkInstance: isolated MoEngageSDKInstance = #isolation
    ) throws(Wrapped.WriteError)

    Parameters

    value

    The value to persist.

    sdkInstance

    The isolated SDK instance to write to.

Available where Wrapped: MoEngageStorage.MigratableLocation

  • Removes the value from the wrapped location.

    Declaration

    Swift

    public func remove(
        fromInstance sdkInstance: isolated MoEngageSDKInstance = #isolation
    ) throws(Wrapped.RemoveError)

    Parameters

    sdkInstance

    The isolated SDK instance to remove from.