Skip to content

Latest commit

 

History

History
20 lines (18 loc) · 729 Bytes

README.md

File metadata and controls

20 lines (18 loc) · 729 Bytes

CoWBox

CoWBox is a high-efficiency property wrapper library for the Swift programming language. Leveraging the Copy-on-Write (CoW) semantics, this library optimizes state management and enhances performance. CoWBox efficiently wraps properties of classes, structures, or any type, delaying memory copies until the uniqueness of a reference is lost, thereby minimizing resource utilization.

Usage

To use CoWBox, simply wrap your property with @CoWBox. For example:

struct MyStruct {
    @CoWBox var myProperty: SomeType
}

ObservedCoWBox

@Observable
final class MyClass {
    @ObservationIgnored
    @ObservedCoWBox var myProperty: SomeType
}

This endows myProperty with Copy-on-Write semantics.