tag | 7069174a91be3fb89926191ffc81472606503432 | |
---|---|---|
tagger | Mishal Shah <mishal_shah@apple.com> | Tue Dec 01 14:50:16 2015 -0800 |
object | 827b74359c934cda63bd6e35a599f50a9352a736 |
Tag build swift-2.2-SNAPSHOT-2015-12-01-a
commit | 827b74359c934cda63bd6e35a599f50a9352a736 | [log] [tgz] |
---|---|---|
author | Philippe Hausler <phausler@apple.com> | Mon Nov 30 16:42:17 2015 -0800 |
committer | Philippe Hausler <phausler@apple.com> | Mon Nov 30 16:42:17 2015 -0800 |
tree | d515ed909dcc03193b8878327ce0673ffdf22738 | |
parent | 3c25860785238bb37f96a0241ba166a718cb1a7f [diff] |
Correct NSFileManager tests to not rely on ordered directory
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 either the Objective-C runtime and language or Swift standard library and language.
It is designed with these goals in mind:
There is more information on the Foundation framework here.
Important: This project is in the early stages of development. It is not yet ready for production use, but it is ready for contributions. It is scheduled to be part of the Swift 3 release.
This project provides an implementation of the Foundation API for platforms where there is no Objective-C runtime. On OS X, iOS, and other Apple platforms, apps should use the Foundation that comes with the operating system. Our goal is to abstract away the exact underlying platform as much as possible.
Our primary goal is to achieve implementation parity with Foundation on Apple platforms. This will help to enable the overall Swift 3 goal of portability.
In our first year, we are not looking to make major API changes to the library. We feel that this will hamper the primary goal. There are some areas where API changes are unavoidable, however. For more information on those APIs and the overall design of Foundation, please see our design document.
One of the goals of the Swift 3 project is a new set of naming guidelines. The Foundation project will soon update all of its names to match the new guidelines. We will also drop the ‘NS’ prefix from all classes.
See our status page for a detailed list of what features are currently implemented.
Here is a simple main.swift
file which uses Foundation. This guide assumes you have already installed a version of the latest Swift binary distribution.
import Foundation // Make an URLComponents instance let swifty = NSURLComponents(string: "https://swift.org")! // Print something useful about the URL print("\(swifty.host!)") // Output: "swift.org"
You will want to use the Swift Package Manager to build your Swift apps.
Please see Getting Started.
We believe that the Swift standard library should remain small and laser-focused on providing support for language primitives. The Foundation framework has the flexibility to include higher-level concepts and to build on top of the standard library, much in the same way that it builds upon the C standard library and Objective-C runtime on Darwin platforms.
There are several reasons why these types are useful in Swift as distinct types from the ones in the standard library:
In general, the dividing line should be drawn in overlapping area of what people consider the language and what people consider to be a library feature.
For example, Optional is a type provided by the standard library. However, the compiler understands the concept to provide support for things like optional-chaining syntax. The compiler also has syntax for creating Arrays and Dictionaries.
On the other hand, the compiler has no built-in support for types like NSURL. NSURL also has ties into more complex functionality like basic networking support. Therefore this type is more appropriate for Foundation.
The Objective-C runtime is not part of the Swift open source project. We can, however, use the open source CoreFoundation implementation. CF is written in C and does not require Objective-C.
We welcome contributions to Foundation! Please see the known issues page if you are looking for an area where we need help. We are also standing by on the mailing lists to answer questions about what is most important to do and what we will accept into the project.