Structures

The following structures are available globally.

  • An option to persist the default value when returned by a Persister.

    See more

    Declaration

    Swift

    public struct DefaultValuePersistOption : OptionSet
  • A property wrapper that wraps a Persister.

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct Persisted<Value>
  • An OSUnfairLock is a wrapper around an unfair lock that locks around accesses to a stored object. It has the same API as OSAllocatedUnfairLock.

    Despite being a struct, it isn’t a value type, as copied instances control the same underlying lock allocation.

    Prefer storing state protected by the lock in State. Containing locked state inside the lock helps track what is protected state and provides a scope where it is safe to access that state.

    When using OSUnfairLock with external state, nonscoped locking allows more flexible locking patterns by using lock() / unlock(), but offers no assistance in tracking what state is protected by the lock.

    This lock must be unlocked from the same thread that locked it. As such, it is unsafe to use lock() / unlock() across an await suspension point. Instead, use withLock to enforce that the lock is only held within a synchronous scope.

    If you are using a lock from asynchronous contexts only, prefer using an actor instead.

    This lock is not a recursive lock. Attempting to lock it again from the same thread while the lock is already locked will crash.

    See more

    Declaration

    Swift

    public struct OSUnfairLock<State> : @unchecked Sendable
  • A type that conforms to DynamicProperty to facilitate automatically updating SwiftUI Views.

    See more

    Declaration

    Swift

    @available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
    @propertyWrapper
    public struct PersistStorage<Value> : DynamicProperty
  • A transformer that aggregates multiple transformers. Multiple aggregate transformers can be chained.

    See more

    Declaration

    Swift

    public struct AggregateTransformer<Input, Output> : Transformer
  • A transformer that transformers values to JSON data.

    See more

    Declaration

    Swift

    public struct JSONTransformer<Input> : Transformer where Input : Decodable, Input : Encodable
  • A transformer that transformers values to property list data.

    See more

    Declaration

    Swift

    public struct PropertyListTransformer<Input> : Transformer where Input : Decodable, Input : Encodable
  • A Transformer that transforms RawRepresentable types.

    See more

    Declaration

    Swift

    public struct RawRepresentableTransformer<Type> : Transformer where Type : RawRepresentable