Last active
August 29, 2015 14:06
-
-
Save stuffmc/b03c2cb55b8084cac985 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 simulate(hexa: Int!) -> NSData! { | |
let string = NSString.stringWithCharacters([0x01], length: 1) // Totally compiles | |
func simulate(hexa: Int!) -> NSData! { | |
let string = NSString.stringWithCharacters([hexa], length: 1) | |
// Compile error: 'UnsafePointer<unichar>' does not have a member named 'Element' | |
FIX: | |
func simulate(hexa: unichar) -> NSData! { | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
unichar(hexa) will blow up if hexa is too big to fit in an unichar. Better make the function accept unichar only.