Skip to content

Instantly share code, notes, and snippets.

@fortmarek
Created September 9, 2020 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fortmarek/8dd3f2b3344419a9eb4a7fe1fc39e46d to your computer and use it in GitHub Desktop.
Save fortmarek/8dd3f2b3344419a9eb4a7fe1fc39e46d to your computer and use it in GitHub Desktop.
extension Scaffold: CustomReflectable {
var customMirror: Mirror {
// #1
let attributesChildren: [Mirror.Child] = Scaffold.attributes
// #2
.map {
(name: $0, option: Option<String>(name: .shortAndLong))
}
// #3
.map {
Mirror.Child(label: $0.name, value: $0.option)
}
// #4
let children = [
Mirror.Child(label: "template", value: _template),
]
// #5
return Mirror(Scaffold(), children: children + attributesChildren)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment