You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Foundation framework defines a low-level layer of functionality that is useful for almost all applications. It is designed with these goals in mind:
3
+
The Foundation framework defines a low-level layer of functionality that is useful for many applications. It is designed with these goals in mind:
4
4
5
5
* Provide a small set of basic utility types.
6
6
* Make software development easier by introducing consistent conventions that can be widely adopted by the Swift ecosystem.
7
7
* Support internationalization and localization, to make software accessible to users around the world.
8
8
* Provide a level of OS independence, to enhance portability.
9
9
10
-
This project is a preview of a unified Swift implementation of Foundation for all platforms. While the new package is not yet complete, it provides the first building blocks for early testing and contributions.
10
+
This project aims to build a new and unified Swift implementation of Foundation for all platforms. The project is in its early stages, with features still to be implemented. Contributions are welcome, including API implementations, bug fixes, documentation, tests and ports to new platforms.
11
+
## Current State
11
12
12
-
## Implementation Progress
13
+
The following types are available in the preview package, with more to come later. Many types, including `JSONEncoder`, `Calendar`, `TimeZone`, and `Locale` are all-new Swift implementations. `FormatStyle` and `ParseStyle` available as open source for the first time.
13
14
14
-
The following types are available in the preview package, with more to come later:
15
-
16
-
* FoundationEssentials
15
+
***FoundationEssentials**
17
16
*`AttributedString`
18
17
*`Data`
19
18
*`Date`
@@ -23,24 +22,21 @@ The following types are available in the preview package, with more to come late
23
22
*`Predicate`
24
23
*`String` extensions
25
24
*`UUID`
26
-
* Internationalization
25
+
***Internationalization**
27
26
*`Calendar`
28
27
*`TimeZone`
29
28
*`Locale`
30
29
*`DateComponents`
31
30
*`FormatStyle`
32
31
*`ParseStrategy`
33
32
34
-
35
-
Wherever possible, code is shared between all platforms. In cases where platform-specific code is needed within a single source file, a compiler directive is used to include or exclude it.
36
-
37
-
For internationalization support on non-Darwin platforms, we created a separate package named *[FoundationICU](https://github.com/apple/swift-foundation-icu)*. This repository contains the necessary ICU implementations and data from the upstream [Apple OSS Distribution ICU](https://github.com/apple-oss-distributions/ICU), wrapped in Swift so FoundationInternationalization can easily depend on it. Using a common version of ICU will result in more reliable and consistent results when formatting dates, times, numbers, and more. As the upstream Apple ICU updates to newer version of ICU, the FoundationICU package will be updated with those changes.
33
+
For internationalization support on non-Darwin platforms, we created a separate package named *[FoundationICU](https://github.com/apple/swift-foundation-icu)*. This repository contains the necessary ICU implementations and data from the upstream [Apple OSS Distribution ICU](https://github.com/apple-oss-distributions/ICU), wrapped in Swift so FoundationInternationalization can easily depend on it. Using a common version of ICU will result in more reliable and consistent results when formatting dates, times, and numbers.
38
34
39
35
> Note: The Foundation Preview package depends on the under-development [Swift 5.9 toolchain](https://www.swift.org/download).
40
36
41
37
## Performance
42
38
43
-
Being written in Swift, this new implementation provides some major benefits over the previous C and Objective-C versions. Code is shared across all platforms, is much easier to read and write, and also provides some great performance improvements.
39
+
Being written in Swift, this new implementation provides some major benefits over the previous C and Objective-C versions.
44
40
45
41
`Locale`, `TimeZone` and `Calendar` no longer require bridging from Objective-C. Common tasks like getting a fixed `Locale` are an order of magnitude faster for Swift clients. `Calendar`'s ability to calculate important dates can take better advantage of Swift’s value semantics to avoid intermediate allocations, resulting in over a 20% improvement in some benchmarks. Date formatting using `FormatStyle` also has some major performance upgrades, showing a massive 150% improvement in a benchmark of formatting with a standard date and time template.
46
42
@@ -54,16 +50,21 @@ For Foundation, our goal is to create the best fundamental data types and intern
54
50
55
51
Moving Foundation into this future requires not only an improved implementation, but also an improved process for using it outside of Apple’s platforms. Therefore, Foundation now has a path for the community to add new API for the benefit of Swift developers on every platform.
56
52
57
-
Swift Foundation is an independent package project in its early incubation stages. Inspired by the workgroups in the Swift project, it has a workgroup to (a) oversee [community API proposals](/Users/tony/Desktop/FoundationPreview_Final.md) and (b) to closely coordinate with developments in the Swift project and those on Apple’s platforms. In the future, we will explore how to sunset the existing [swift-corelibs-foundation](https://github.com/apple/swift-corelibs-foundation) and migrate to using the new version of Foundation created by this project.
53
+
The Foundation package is an independent project in its early incubation stages. Inspired by the workgroups in the Swift project, it has a workgroup to (a) oversee [community API proposals](/Users/tony/Desktop/FoundationPreview_Final.md) and (b) to closely coordinate with developments in the Swift project and those on Apple’s platforms. In the future, we will explore how to sunset the existing [swift-corelibs-foundation](https://github.com/apple/swift-corelibs-foundation) and migrate to using the new version of Foundation created by this project.
58
54
59
-
The workgroup meets regularly to review proposals, look at emerging trends in the Swift on Server ecosystem, and discuss how the library can evolve to best meet our common goals.
60
-
## Next Steps
55
+
The workgroup meets regularly to review proposals, look at emerging trends in the Swift ecosystem, and discuss how the library can evolve to best meet our common goals.
56
+
## Current Focus Area for Development
61
57
62
58
Quality and performance are our two most important goals for the project. Therefore, the plans for the first half of 2023 are continuing refinement of the core API, adding to our suites of unit and performance tests, and expanding to other platforms where possible, using the most relevant code from [swift-corelibs-foundation](https://github.com/apple/swift-corelibs-foundation).
63
59
64
-
We also want to try out our new community API proposal process. We aim to accept around three small proposals with corresponding Swift implementations. Experience from running reviews and accepting new API will help to refine the process, and allow scaling up to more contributions later this year and beyond.
65
-
66
60
Later this year, the porting effort will continue. It will bring high quality Swift implementations of additional important Foundation API such as `URL`, `Bundle`, `FileManager`, `FileHandle`, `Process`, `SortDescriptor`, `SortComparator` and more.
61
+
62
+
## Relationship of Foundation Package and Foundation Framework
63
+
64
+
The Swift code in the package is the core of the Foundation framework that ships on macOS, iOS, and other Apple platforms. As new Swift implementations of Foundation API are implemented in the package, Apple will use those implementations in the framework as well.
65
+
66
+
The Foundation framework may have the occasional need to add Darwin-specific API, but our goal is to share as much code and API between all platforms as possible. In cases where platform-specific code is needed within a single source file, a compiler directive is used to include or exclude it.
67
+
67
68
## Contributions
68
69
69
-
Foundation welcomes contributions from the community that align with our goals for the project. The package uses[GitHub Issues](https://github.com/apple/swift-corelibs-foundation) for tracking bugs, feature requests, and other work. Please see the [CONTRIBUTING](https://github.com/apple/swift-foundation/blob/main/CONTRIBUTING.md) document for more information, including the process for accepting community contributions for new API in Foundation.
70
+
Foundation welcomes contributions from the community. The project uses the [Swift forums for discussion](https://forums.swift.org/c/related-projects/foundation/99) and[GitHub Issues](https://github.com/apple/swift-corelibs-foundation) for tracking bugs, feature requests, and other work. Please see the [CONTRIBUTING](https://github.com/apple/swift-foundation/blob/main/CONTRIBUTING.md) document for more information, including the process for accepting community contributions for new API in Foundation.
0 commit comments