Swift 5 Officially Released, Here’s Whats New

Swift 5

Swift, the general-purpose programming language popular with iOS developers has recently released a major update with Swift 5.

According to the team behind Swift, Swift 5 is a major milestone in the evolution of the language. As ABI stability has been achieved with Swift 5, Swift runtime is now incorporated into all current and future versions of macOS, iOS, tvOS and watchOS. Which is great news for app developers as with Swift 5, apps will now be easier to develop and has smaller size because they won’t have to include the macOS, iOS, tvOS and watchOS runtime libraries anymore.

Here’s what’s new in Swift 5:

Standard Library Updates

  • String reimplemented with UTF-8 encoding which can often result in faster code
  • Improved support for raw text in string literals
  • Result and SIMD vector types added to the Standard Library
  • Enhancements to String interpolation, adding more flexibility to construct text from data
  • Performance improvements to Dictionary and Set
  • Enhancing String Literals Delimiters to Support Raw Text
  • Add Unicode Properties to Unicode.Scalar
  • Renaming the DictionaryLiteral type to KeyValuePairs
  • Conform Never to Equatable and Hashable
  • Introduce compactMapValues to Dictionary
  • Character Properties
  • Adding isMultiple to BinaryInteger
  • Fix ExpressibleByStringInterpolation
  • SIMD Vectors
  • Remove Some Customization Points from the Standard Library’s Collection Hierarchy
  • Make Numeric Refine a new AdditiveArithmetic Protocol
  • Remove Sequence.SubSequence
  • Add Result to the Standard Library
  • Introduce withContiguous{Mutable}StorageIfAvailable methods
  • Add Codable conformance to Range types
  • Deprecate String Index Encoded Offsets

Additional Language and Compiler Updates

  • Swift 5 defaults to enforcing exclusive access to memory for both debug and release builds
  • Supports dynamically callable types that help improve interoperability with dynamic languages such as Python, JavaScript and Ruby.
  • Handling Future Enum Cases
  • Literal initialization via coercion
  • Introduce user-defined dynamically “callable” types
  • Support ‘less than’ operator in compilation conditions
  • Identity key path
  • Flatten nested optionals resulting from ‘try?’

Package Manager Updates

Dominate the App Store.

Get the latest industry news first.

  • The swift run command now includes the ability to import libraries in a REPL without needing to build an executable.
  • Package Manager Dependency Mirroring
  • Package Manager Platform Deployment Settings
  • Package Manager Target Specific Build Settings

You can test the new features in Swift 5 via this Xcode playground from Github.

  • Raw strings
  • A standard Result type
  • Customizing string interpolation
  • Dynamically callable types
  • Handling future enum cases
  • Flattening nested optionals resulting from try?
  • Checking for integer multiples
  • Transforming and unwrapping dictionary values with compactMapValues()

 

You can download Swift 5 from the official website here, and you can read the updated version of The Swift Programming Language for Swift 5 here. You can also download it from the Apple Bookstore for free here.

 

Image Credit: udemy

Dominate the App Store.

Get the latest industry news first.

Roamni Case Study
How Jason & Greg Built an App Worth Over $5 Million
  • How to Get $100,000s in Funding for Your App
  • What Makes a Profitable and Successful App
  • 7 Critical Entrepreneurial Lessons From Jason and Greg
  • How to Create Apps that Get People Hooked