extension MemoryLayout {
static func size<Value>(ofFieldAt path: KeyPath<T, Value>) -> Int? {
MemoryLayout.offset(of: path).map { _ in MemoryLayout<Value>.size }
}
}
If we're continuing, let's make a new thread.
extension MemoryLayout {
static func size<Value>(ofFieldAt path: KeyPath<T, Value>) -> Int? {
MemoryLayout.offset(of: path).map { _ in MemoryLayout<Value>.size }
}
}
If we're continuing, let's make a new thread.
I must say this is a genius hack! It answers my question so no need for an extra thread.