KeyPathStorage
extension MoEngageStorage.KeyPathStorage: MoEngageStorage.ReadOnlyLocation
extension MoEngageStorage.KeyPathStorage: @unchecked Sendable
extension MoEngageStorage.KeyPathStorage: MoEngageStorage.WriteOnlyLocation
where
Location: MoEngageStorage.WriteOnlyLocation,
Path: WritableKeyPath<Location.Stored, Value>,
Location.Input == Void,
Location.Stored == Location.Saved
extension MoEngageStorage.KeyPathStorage: MoEngageStorage.MigratableLocation
where
Self: MoEngageStorage.WriteOnlyLocation,
Value: MoEngageStorage.ResettableValue
extension MoEngageStorage.KeyPathStorage: Equatable where Location: Equatable
extension MoEngageStorage.KeyPathStorage: Hashable where Location: Hashable
-
Reads the sub-value at
keyPathfrom the underlying location.Declaration
Swift
public func read( withInput input: Location.Input, fromInstance sdkInstance: isolated MoEngageSDKInstance = #isolation ) throws(Location.ReadError) -> ValueParameters
inputForwarded to the underlying location’s
read.sdkInstanceThe isolated SDK instance to read from.
Return Value
The value at the key path within the stored composite value.
-
Writes a value at
keyPathby loading the currentRoot, mutating the field, and saving the modifiedRootback.If reading the current root throws, the error is wrapped in
WriteOperationError/readFailed(_:). If the subsequent write throws, the error is wrapped inWriteOperationError/writeFailed(_:).Declaration
Swift
public func write( _ value: Value, toInstance sdkInstance: isolated MoEngageSDKInstance = #isolation ) throws(WriteOperationError<Location.ReadError, Location.WriteError>) -> Location.OutputParameters
valueThe new sub-value to store.
sdkInstanceThe isolated SDK instance to write to.
-
Resets the field at
keyPathtoMoEngageStorage/ResettableValue/resetValue.Delegates to
write, so the error type mirrorsWriteOperationError:WriteOperationError/readFailed(_:)if loading the root fails, orWriteOperationError/writeFailed(_:)if saving fails.Declaration
Swift
public func remove( fromInstance sdkInstance: isolated MoEngageSDKInstance = #isolation ) throws(WriteOperationError<Location.ReadError, Location.WriteError>) -> Location.OutputParameters
sdkInstanceThe isolated SDK instance to write to.