-
-
Save sferrini/4f1db46183b2cc75438fb597f019cc9a 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
//: Playground - noun: a place where people can play | |
struct User { | |
var name: String | |
init() { | |
name = "" | |
} | |
} | |
class UserProfile { | |
var user: User = User() { | |
didSet { | |
print("didSet \(user.name)") | |
} | |
} | |
} | |
let userProfile = UserProfile() | |
var user = User() | |
userProfile.user = User() | |
userProfile.user.name = "First Update" | |
withUnsafePointer(to: &userProfile.user.name) { | |
print("name has address: \($0)") | |
} | |
userProfile.user.name = "Second Update" | |
withUnsafePointer(to: &userProfile.user.name) { | |
print("name has address: \($0)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment