PublishedConstrainedValue
@propertyWrapper
public struct PublishedConstrainedValue<Value> where Value : Strideable
A property wrapper combined both @ConstrainedValue and @Published
Usage
@PublishedConstrainedValue(0...10) public var width: CGFloat = 1
-
The property that can be accessed with the
$
syntax and allows access to thePublisher
Declaration
Swift
public var projectedValue: AnyPublisher<Value, Never> { get }
-
Refer to SE-0258 property-wrappers Reference the enclosing ‘self’ in a wrapper type. Receives self as a parameter, along with key paths referencing the original wrapped property and the backing storage property.
Declaration
Swift
public static subscript<EnclosingSelf: ObservableObject>( _enclosingInstance object: EnclosingSelf, wrapped wrappedKeyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>, storage storageKeyPath: ReferenceWritableKeyPath<EnclosingSelf, Self> ) -> Value where EnclosingSelf.ObjectWillChangePublisher == ObservableObjectPublisher