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

How to improve user retention rate? Share 6 rules!

Retention rate is the most important criterion fo...

What issues do you need to consider when you first start UI design?

For newcomers who are new to the UI field, in add...

CCTV's "Weekly Quality Report": Hidden Concerns of Mobile Payment

Introduction: CCTV's "Weekly Quality Repo...

Marketing course-It is important to introduce products to customers step by step

The secret to successful sales is to skillfully l...

Plants also have "social phobias" and become "shy" when touched lightly →

If you touch it lightly, its leaves will close im...

Apple pushes new test systems such as iOS 11.4.1

Recently, Apple released the third beta versions ...

Share: HTML5 game development experience and development tools

[[147966]] When you develop a game based on HTML5...

After Webb, space will welcome these detection artifacts

For humans, 2021 is coming to an end. But for ast...

10 days to help you master Python 2020

Tutorial Introduction Master the basic Python syn...