vds_ios/VDS/PropertyWrappers/Debuggable.swift
Matt Bruce d0b2dfd0b1 refactored propertywrappers
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2022-08-11 15:12:14 -05:00

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
}
}
}