Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

Swift 5 for Xcode 10.2 beta is here with stable ABI

Save for later
  • 3 min read
  • 25 Jan 2019

article-image

Apple announced Swift 5 for their Xcode 10.2 compiler. Swift in Xcode 10.2 beta brings a couple of new features like smaller app sizes when testing, new library, compiler features, and more. The application binary interface (ABI) is stable in Swift 5.

Smaller app size


App sizes on Swift 5 in Xcode 10.2 beta can be smaller now when deployed for testing. This is true when using TestFlight or when thinning an app for local distribution. Smaller app sizes are possible as Swift apps don’t include dynamically linked libraries for the Swift standard library anymore. Moreover, Swift SDK overlays for devices running iOS 12.2, watchOS 5.2, and tvOS 12.2. Apple calls this concept ‘App thinning’.

New features in Swift 5

  • A new attribute named @dynamicCallable allows dynamic language interoperability. Key paths support the identity keypath \.self.
  • You can no longer write functions that take variadic arguments. Now you can change the enumeration case to ‘take an array explicitly and pass an array in.’
  • A try? block with an Optional type does not return a nested optional, instead of flattening the resulting option
  • Literal types are modified so that expressions don’t overflow the default integer literal where the type is Int.
  • String interpolation is now simpler, has better performance and efficiency.

Changes in the Swift standard library

  • The DictionaryLiteral type is now KeyValuePairs
  • Swift strings bridged into Objective-C code can now return a non-nil value in certain cases
  • The Sequence protocol is now disassociated from SubSequence.
  • Native encoding in the string structure is now UTF-8 instead of UTF-16.

What’s new in Swift package manager?

  • When using Swift 5, targets can now declare commonly used build settings that are target-specific.
  • Unlock access to the largest independent learning library in Tech for FREE!
    Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
    Renews at $19.99/month. Cancel anytime
  • In the Swift 5 Package.swift tools-version, packages can customize minimum deployment target settings.
  • Top level packages can override dependency URLs
  • The --enable-code-coverage flag helps other tools to use code coverage data generated by a tool
  • Support for Swift 3 Package.swift tools-version has been dropped
  • Larger packages are handled better by the package manager
  • Package resolution for incompatible dependency versions are forced to fail
  • A new --repl option in swift run launches the Swift REPL. This supports importing library targets of a package.

Swift compiler

  • Exclusive memory access is imposed at runtime by default.
  • Swift 3 is removed.
  • In Swift 5, switches on enumerations declared in Objective-C/system frameworks have to handle unknown cases
  • For Swift modules, default arguments are printed in SourceKit-generated interfaces
  • Support for Optional types is now added in unowned and unowned(unsafe) variables


To know more details and bug fixes, visit the release notes.

Swift is now available on Fedora 28

ABI stability may finally come in Swift 5.0

Swift 4.2 releases with language, library and package manager updates!