Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import UIKit
class Foo {
var bar: Int
init(bar: Int) {
self.bar = bar
}
}
struct K {
static let x = Foo(bar: 1)
}
let y = Foo(bar: 1)
func change(_ foo: Foo, to: Int) {
foo.bar = to
}
change(y, to: 3)
change(K.x, to: 3)
print("y \(y.bar)") // prints y 3
print("K.x \(K.x.bar)") // prints K.x 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment