Created
April 24, 2018 08:03
-
-
Save vialyx/62ec15f6bdcfb3a648a5227e30586ccd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// MARK: - strong reference counting | |
var customer1stRef: Customer? = nil | |
var customer2ndRef: Customer? = nil | |
customer1stRef = Customer(udid: "1st", name: "Maxim") | |
/* | |
print: 1st initialized | |
*/ | |
customer2ndRef = customer1stRef | |
customer1stRef = nil | |
/* | |
Customer class instance don't deallocated after nil set to customer1stRef. | |
That happened because it has a strong reference in customer2ndRef | |
*/ | |
customer2ndRef = nil | |
/* | |
print: 1st deinitialized | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment