Skip to content

Instantly share code, notes, and snippets.

@toshi0383
Created October 30, 2015 05:19
Show Gist options
  • Select an option

  • Save toshi0383/b05af07b4c42f91eb3fe to your computer and use it in GitHub Desktop.

Select an option

Save toshi0383/b05af07b4c42f91eb3fe to your computer and use it in GitHub Desktop.
functionの引数はコピーで渡されるのかと思ってたけど違った。 #CodePiece
import UIKit
class C {
var view:UIView
init(view:UIView) {
self.view = view
}
}
var v = UIView()
var c = C(view:v)
Swift.print(c.view.frame) // (0.0, 0.0, 0.0, 0.0)
v.frame = CGRectMake(0, 0, 100, 100)
Swift.print(c.view.frame) // (0.0, 0.0, 100.0, 100.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment