Created
February 19, 2019 18:55
-
-
Save keremvatandas/b59bb945c004acd0d38135246b11b8a6 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
| func printAddress<T>(of pointer: UnsafePointer<T>) { | |
| print(pointer) | |
| } | |
| var ival: Int = 3 | |
| printAddress(of: &ival) // 0x00000001003edec0 | |
| var anyType: Any | |
| anyType = ival | |
| printAddress(of: &anyType) // 0x00000001003edec8 | |
| // anyType ival nesnesini gostermiyor, ival nesnesinin kopyasini gosteriyor | |
| // Hemen ival nesnesinde degisiklik yapiyorum | |
| ival = 999 | |
| // Eger anyType ival nesnesini gosteriyorsa degeri 999 olmasi gerekiyor | |
| print(anyType as! Int) // 3 degerini gosteriyor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment