Created
April 2, 2017 07:58
-
-
Save kateinoigakukun/da23a2af8800c346ea00e12e85f62612 to your computer and use it in GitHub Desktop.
お〜 #CodePiece
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
enum Fruit { | |
case peach | |
case apple | |
case grape | |
} | |
var i = 0 | |
var peachPtr = withUnsafePointer(to: &i) { UnsafeRawPointer($0) } | |
.bindMemory(to: Fruit.self, | |
capacity: MemoryLayout<Fruit>.size) | |
peachPtr.pointee // peach |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment