Skip to content

Instantly share code, notes, and snippets.

@rex-remind101
rex-remind101 / 🐮.swift
Last active August 28, 2023 04:40
Copy-On-Write Swift Property Wrapper
final private class Ref<T> {
var value: T
init(_ v: T) { self.value = v }
}
@propertyWrapper
public struct CopyOnWrite<T> {
private var ref: Ref<T>
public init(_ value: T) {