Search code examples
swiftxcode6

Expected hexadecimal code in braces after unicode escape


This worked in the first beta of Swift.

var degree = "\u00B0" // degree symbol

Now I'm getting this error and I don't understand what I need to do to correct it in Xcode 6 Beta 5.

Expected hexadecimal code in braces after unicode escape

Solution

  • The correct code is:

    var degree = "\u{00B0}" // degree symbol
    

    From the Xcode 6 beta 4 release notes:

    The \x, \u and \U escape sequences in string literals have been consolidated into a single and less error prone \u{123456} syntax. (17279286)