Created
September 14, 2017 09:25
-
-
Save Francescu/7ffcfe58daa73d608f20b27b9cc3f791 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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