Skip to content

Instantly share code, notes, and snippets.

@RockfordWei
Created August 31, 2017 19:24
Show Gist options
  • Save RockfordWei/6db50b2681ae598d9a79b33dbf2ab8df to your computer and use it in GitHub Desktop.
Save RockfordWei/6db50b2681ae598d9a79b33dbf2ab8df to your computer and use it in GitHub Desktop.
Swift 4 Struct Description
import Foundation
public struct Person {
public var name = ""
public var age = 0
}
let rocky = Person(name: "rocky", age: 24)
print(rocky)
let mirror = Mirror(reflecting: rocky)
for (key, value) in mirror.children {
guard let k = key else {
continue
}
print(k, value)
}
print(Person.self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment