MappingStorage

extension MoEngageStorage.MappingStorage: MoEngageStorage.ReadOnlyLocation
where Location: MoEngageStorage.ReadOnlyLocation, Location.Stored == MappingFrom
extension MoEngageStorage.MappingStorage: MoEngageStorage.WriteOnlyLocation
where Location: MoEngageStorage.WriteOnlyLocation, Location.Saved == MappingTo
extension MoEngageStorage.MappingStorage: MoEngageStorage.MigratableLocation
where Location: MoEngageStorage.MigratableLocation

Available where Location: MoEngageStorage.ReadOnlyLocation, Location.Stored == MappingFrom

  • Reads the raw stored value and converts it to Value using fromAction.

    Declaration

    Swift

    public func read(
        withInput input: Location.Input,
        fromInstance sdkInstance: isolated MoEngageSDKInstance = #isolation
    ) throws(Location.ReadError) -> Value

    Parameters

    input

    Unused (Void).

    sdkInstance

    The isolated SDK instance to read from.

    Return Value

    The mapped value.

Available where Location: MoEngageStorage.WriteOnlyLocation, Location.Saved == MappingTo

  • Converts value to the raw stored type using toAction and writes it, provided writeCondition returns true.

    Declaration

    Swift

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

    Parameters

    value

    The mapped value to persist.

    sdkInstance

    The isolated SDK instance to write to.

Available where Location: MoEngageStorage.MigratableLocation

  • Removes the raw value from the underlying location, provided writeCondition returns true.

    Declaration

    Swift

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

    Parameters

    sdkInstance

    The isolated SDK instance to remove from.