Our Blogs

Swift 4 Released With New Features & Improvements

September 24, 2017
Swift 4 Released With New Features & Improvements
Swift 4 has been released with plenty of new features and enhancements. In addition to the updates, the Swift 4 also includes new String features and improvements to archival, serialization and extended collections. The strings abide by the Collection protocol, which enables them directly iterable. Moreover, the Swift 4 also provides new features for sequences and collections.

With Swift 4, the string slices are instances of type Substring, which automatically adheres to StringProtocol. The purpose of this feature is to improve the slicing performance. Moreover, the copy operation can be isolated in such a way that the Substing is converted into a String consumed by API. 

The Swift 4 also provides support for multi-line literals and Unicode 9. The new release also helps you to improve the creation, usage, and management of collection types such as Set and Dictionary. It is now possible to create a dictionary from a sequence of tuples. Moreover, you can also give instructions for handling duplications, which can be done during the creation and merging of dictionaries.

In Swift 4, you can filter Dictionary and Set into another object instead of an Array. Moreover, the dictionaries provide support for a new mapValues method. It is also possible to specify a default value when accessing elements related to dictionaries. Furthermore, the collection types provide support for generic subscripts.

The highlight of Swift 4 is the support for archival and serialization. Prior to Swift 5, you need to work with these features via NSObject and NSCoding. The new release also adds serialization to all the required types via the Codable protocol. The addition of two language modes in Swift 4 can be selected via the -swift-version compiler option.

No doubt, the Swift 4 will bring in a wide range of possibilities not only to simplify the development process but also to improve productivity.