Created
April 2, 2017 07:59
-
-
Save kateinoigakukun/51c2a799ba34022012371421165db253 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