32 lines
711 B
Swift
32 lines
711 B
Swift
//
|
|
// File.swift
|
|
// VDS
|
|
//
|
|
// Created by Matt Bruce on 8/11/22.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
@propertyWrapper
|
|
public struct Debuggable<Value> {
|
|
private var value: Value
|
|
private let description: String
|
|
|
|
public init(wrappedValue: Value, description: String = "") {
|
|
print("Initialized '\(description)' with value \(wrappedValue)")
|
|
self.value = wrappedValue
|
|
self.description = description
|
|
}
|
|
|
|
public var wrappedValue: Value {
|
|
get {
|
|
print("Accessing '\(description)', returning: \(value)")
|
|
return value
|
|
}
|
|
set {
|
|
print("Updating '\(description)', newValue: \(newValue)")
|
|
value = newValue
|
|
}
|
|
}
|
|
}
|