Skip to content

Instantly share code, notes, and snippets.

@TsRebornz
Created October 20, 2022 15:44
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 TsRebornz/b549f3614ca4ae866a450de33e5cd1da to your computer and use it in GitHub Desktop.
Save TsRebornz/b549f3614ca4ae866a450de33e5cd1da to your computer and use it in GitHub Desktop.
class Size { // Changed to class
var width: Int
let height: Int
init(width: Int, height: Int) {
self.width = width
self.height = height
}
}
struct Table {
let size: Size
let material: String
}
let tableSizeKeyPath = \Table.size.width // ReferenceWritableKeyPath<Table, Int>
let tableMaterialKeyPath = \Table.material // KeyPath<Table, String>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment