DEV Community

Dmytro Pylypenko
Dmytro Pylypenko

Posted on

Swift 5. What is new?

Swift 5 is ABI stable, which gives direct compatibility with OS without additional layers and backward compatibility between different versions of Swift, beginning from 5.0 version.

Also the new version has a lot of improvements:

  1. Flattened try? with Optional type
    No more double guard.

  2. Raw strings
    Gives one of the possibility to write a string without escaping characters inside. It's very feature for writing raw RegEx expressions in a clean way.


    If you need to embed a variable inside a raw string, you must add hash symbol after backslash: #"(\\|\#(variable))"#

  3. String interpolation
    Declaration can be flexible and behave on your own.
    For this, extend the protocol StringInterpolation with own function:

  4. No recursion inside computed properties
    Avoid additional layer for computations, and have it inside a closure.


It was a part of described features, more is there:

Article on Medium:

Top comments (3)

eljayadobe profile image

Swift 1.x to 2.0 was a major change. (I'd call 1.x alpha quality.)

Swift 2.0 to 3.0 was also a major change. (I'd call 2.0 beta quality.)

Swift 3.0 to 4.0 to 4.1 to 4.2 to 5 all seem like minor fit-and-finish changes. To me, this is a good thing. The language is settled, mature. Literature on 3.0 is probably entirely or nearly entirely applicable to 5.

peterwitham profile image
Peter Witham

I think there will be a lot to love about Swift 5, I am hoping that they stay true to the commitment to include the runtime in OS' so it is no longer part of app installs.

dimpiax profile image
Dmytro Pylypenko

So be it! :)