Skip to content

Instantly share code, notes, and snippets.

@wm3
Last active February 11, 2017 09:04
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 wm3/2db9b78f9112917e1c3fa909abf11cf5 to your computer and use it in GitHub Desktop.
Save wm3/2db9b78f9112917e1c3fa909abf11cf5 to your computer and use it in GitHub Desktop.
struct A { var v: Int }
struct B {
var _a = A(v: 0)
var a: A {
get { print("get \(_a)"); return _a }
set(a) { print("set \(a)"); _a = a }
}
}
var b = B()
b.a.v = 3
// Output
// ----------------
// get A(v: 0)
// set A(v: 3)
// get A(v: 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment