Fork me on GitHub

核心函式庫(英文)

The Swift Core Libraries project provides higher-level functionality than the Swift standard library. These libraries provide powerful tools that developers can depend upon across all the platforms that Swift supports. The Core Libraries have a goal of providing stable and useful features in the following key areas:

Project Status

These libraries are part of the work towards the future Swift 3 release. They are not yet ready for production use, and in fact are still in the earliest stages of development. We choose to make them part of the initial open source release so that we can work on them together with the community from the beginning. The mailing list page has details on how to join the conversation.

Writing code that provides all of this functionality from scratch would be an enormous undertaking. Therefore, we’ve decided to bootstrap this project by taking advantage of great work that has already been done in these areas. Specifically, we will reuse the API and as much implementation as is possible from three existing libraries: Foundation, libdispatch, and XCTest.


Foundation

The Foundation framework defines a base layer of functionality that is required for almost all applications. It provides primitive classes and introduces several paradigms that define functionality not provided by the language or runtime. It is designed with these goals in mind:

More information about the Foundation framework in general is available from Apple’s documentation. The Swift.org version of Foundation makes use of many of the same underlying libraries (e.g. ICU and CoreFoundation) as Apple’s implementation, but has been built to be completely independent of the Objective-C runtime. Because of this, it is a substantial reimplementation of the same API, using pure Swift code layered on top of these common underlying libraries. Much more information about this work is available on our GitHub project page.

libdispatch

Grand Central Dispatch (GCD or libdispatch) provides comprehensive support for concurrent code execution on multicore hardware.

libdispatch is currently available on all Darwin platforms. This project aims to make a modern version of libdispatch available on all other Swift platforms. To do this, we will implement as much of the portable subset of the API as possible, using the existing open source C implementation.

More information about libdispatch for Linux is available on our GitHub project page.

XCTest

The XCTest library is designed to provide a common framework for writing unit tests in Swift, for Swift packages and applications.

This version of XCTest uses the same API as the XCTest you are familiar with from Xcode. Our goal is to enable your project’s tests to run on all Swift platforms without having to rewrite them.

More information about XCTest on Linux is available on our GitHub project page.


As stated above, this project is in its early days. We look forward to working together with the community to create a great set of libraries that enable Swift to produce powerful software across platforms.