Swift 3 API Design Guidelines

Swift 3 API Design Guidelines

[[158193]]

The design concept of a programming language's standard library often has a great impact on the overall feeling of the programming language. A good standard library is like an extension of the language itself, and ensuring the consistency within the standard library can effectively improve the overall development experience. In order to build a good Swift standard library, one of the main goals of Swift 3 is to define a set of API design guidelines and apply these guidelines consistently.

The Swift API design guidelines contain several main goals, all of which are aimed at unifying the development style of Swift. These main goals are:

  • Swift API Design Guidelines: The actual API design guidelines are currently under active development. Currently, the first draft of the Swift API Design Guidelines is available for viewing!

  • Swift Standard Library: The entire Swift standard library is being reviewed and updated to follow the Swift API Design Guidelines. The actual work is happening in the swift-3-api-guidelines branch of the Swift repository.

  • Importing Objective-C APIs: Work is underway to translate Objective-C APIs into Swift, using several heuristics to better match the Swift API design guidelines. The proposed Swift translation guidelines for Objective-C APIs describes which translations are available. Of course, since this process uses a series of heuristics, we will track its impact on Cocoa and Cocoa Touch, including the work of Swift code using these frameworks. The Swift 3 API Design Guidelines Review repository provides a way to view this automatic translation process to see the impact on Swift code using Cocoa and Cocoa Touch. Certain Objective-C APIs that will not be translated into Swift will be marked (for example, using the NS_SWIFT_NAME macro) to improve the quality of the resulting Swift code. While this change primarily affects Apple platforms, it will also have some direct impact on cross-platform Swift core libraries that provide the same APIs as Objective-C frameworks (such as the Objective-C runtime used in Swift).

  • Swift Design Guidelines Check: Existing Swift code follows different coding styles, including Objective-C coding guidelines for Cocoa. With the heuristic logic used to import Objective-C APIs, the Swift compiler can check for common API design patterns, find APIs that do not meet the Swift API Design Guidelines, and provide suggestions.

  • Swift 2 migration to Swift 3: Swift standard library and importing Objective-C API will be a major update of Swift, and a new correction operation will be made to the source code. Therefore, we also need to create a migrator that can migrate Swift 2 code to Swift 3 API.

All of these major efforts are under active development. If you are interested in following the work, you can check out the Swift API design guidelines, the Swift standard library changes, the Objective-C API importer changes proposal, and the current review repository, and join the discussion on the swift-evolution mailing list.

<<:  Google's latest app Cardboard Camera turns your phone into a VR camera

>>:  iOS 9 adoption rate slowed down, increasing by 4 percentage points to 70% in November

Recommend

AppStore latest review guidelines 2017

Apps are changing the world, enriching people’s l...

There are 40 days in the dog days of 2020. When does the dog days of 2020 start?

There are 40 days in the dog days of 2020 Today i...

"Watching the Sea" During the Flood Season, Learn About Scientific Flood Control

Every summer, when the flood season arrives, cont...

Why can't I hear clearly when I speak with a mask on?

In the oral exam during the epidemic, You need to...

The five core actions of B Station’s brand operation and deployment!

Nowadays, Bilibili has become one of the most pop...

How long will live streaming sales be popular?

If there is any difference between the 2019 Doubl...

What does the new edible battery taste like? Crunchy chicken?

Audit Expert: Wang Jinlu, Power R&D Director,...

The iPhone 6 Plus may not be as popular as we thought

Earlier last month, Apple announced that the firs...

What is the lowest price per gram of good Cordyceps sinensis?

As a precious tonic medicine, Cordyceps sinensis ...

Little Fox's Minimalist Butt Lifting Course

Introduction to Little Fox's Minimalist Butt ...

"Taming" proteins in a test tube: directed evolution of enzymes

The continuation of life requires energy, and the...