Swift 5. What is new?

Dmytro Pylypenko
2 min readJan 27, 2019

--

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.

--

--