Read What’s new in Swift 5.0; Watched String Interpolation in Swift 5 (Part 2)
Watched String Interpolation in Swift 5 (Part 2).
Read What’s new in Swift 5.0:
Result
is now part of Swift bringing new features:get()
method either returning the successful value or throwing error- initializer accepting a throwing closure makes possible
let r = Result { try String(contentsOfFile: f) }
- general
Error
protocol could be used, rather than usingResult<Int, NetworkError>
could useResult<Int, Error>
- raw strings;
- customizable string interpolation bring absolutely crazy stuff. should experiment with it (TODO:);
@dynamicCallable
serves for Python or JavaScript bridging but could be used for creating some creasy stuff;@unknown
for handling future enum cases;- nested optionals resulting from
try?
are flattened; isMultiple(of:)
for checks likerowNumber % 2 == 0
;compactMapValues()
in dictionaries for transforming values while keeping keys intact;count(where:)
was discarded in betatesting, may be will return in later swift versions;
Other sources mention also:
- Conform Never to Equatable and Hashable;
- Add Unicode Properties to Unicode.Scalar
isAlphabetic
,isASCIIHexDigit
and so on; - Character Properties like
isASCII
; - Add Codable conformance to Range types.
By the way, CHANGELOG is available!