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

Lin Yao | Reaching more possibilities through scientific research

At the beginning of 2023, the Chronic Disease Man...

10 tips you must know for event operation!

There is a general basic principle for organizing...

17 psychological phenomena that planners and promoters must know in 2020

Consumer insights , which marketers often talk ab...

5,000 words to reveal the dilemma of live streaming traffic!

I have done a point-to-point breakdown of the ope...

Win10 pops up junk ads on third-party browsers and pushes its own browser

Microsoft has recently started another wave of Wi...

Google launches simplified Android system in India to develop low-end market

Google recently released a simplified version of ...

Why Android apps start slowly? Xiaomi engineers blame Taobao

There have always been comments about the poor an...

Trivia about how the ancients repelled mosquitoes

Annoying mosquitoes are not only a headache for m...

Unveiling corn's 'selfish' gene

Helps curb pollen drift and provides a new isolat...

TV customized air combat game is coming "Overlord" first experience

Screen: Sound Effects: operate: Plot: Experience:...

How to break the trick of using AI face-changing to defraud people?

With the continuous advancement of technology AI ...