Created
January 16, 2016 17:59
-
-
Save hanawat/2edc4aa4045c61c562ba to your computer and use it in GitHub Desktop.
Inheritance to Class (NSObject), it'll be the reference type.
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 Foundation | |
let apple: NSMutableArray = ["π", "π"] | |
var orange = apple | |
orange.replaceObjectsInRange(NSMakeRange(0, apple.count), withObjectsFromArray: ["π", "π"]) | |
print("apple=\(apple)", "orange=\(orange)") // a=[π, π] b=[π, π] |
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 Foundation | |
let apple: NSMutableString = "π" | |
let orange: NSMutableString = apple | |
orange.setString("π") | |
print("apple=\(apple)", "orange=\(orange)") // a=π b=π |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment