- Notifications
You must be signed in to change notification settings - Fork10.4k
The Swift Programming Language
License
swiftlang/swift
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Cross-Compilation Targets
Target | Build |
---|---|
wasm32-unknown-wasi |
Swift Community-Hosted CI Platforms
OS | Architecture | Build |
---|---|---|
Android | X86_64 | |
Android | AArch64 | |
Windows 2019 (VS 2019) | x86_64 |
Swift is a high-performance system programming language. It has a cleanand modern syntax, offers seamless access to existing C and Objective-C codeand frameworks, and is memory-safe by default.
Although inspired by Objective-C and many other languages, Swift is not itself aC-derived language. As a complete and independent language, Swift packages corefeatures like flow control, data structures, and functions, with high-levelconstructs like objects, protocols, closures, and generics. Swift embracesmodules, eliminating the need for headers and the code duplication they entail.
To learn more about the programming language, visitswift.org.
Contributions to Swift are welcomed and encouraged! Please see theContributing to Swift guide.
Before submitting the pull request, please make sure you havetested yourchangesand that they follow the Swift projectguidelines for contributingcode.
To be a truly great community,Swift.org needs to welcomedevelopers from all walks of life, with different backgrounds, and with a widerange of experience. A diverse and friendly community will have more greatideas, more unique perspectives, and produce more great code. We will workdiligently to make the Swift community welcoming to everyone.
To give clarity of what is expected of our members, Swift has adopted thecode of conduct defined by the Contributor Covenant. This document is usedacross many open source communities, and we think it articulates our valueswell. For more, see theCode of Conduct.
If you are interested in:
- Contributing fixes and features to the compiler: See ourHow to Submit Your First Pull Request guide.
- Building the compiler as a one-off: See ourGetting Started guide.
- Building a toolchain as a one-off: Follow theGetting Started guideup until the "Building the project" section. After that, follow theinstructions in theSwift Toolchains section below.
We also have anFAQ that answers common questions.
Swift toolchains are created using the scriptbuild-toolchain. Thisscript is used by swift.org's CI to produce snapshots and can allow for one tolocally reproduce such builds for development or distribution purposes. A typicalinvocation looks like the following:
$ ./swift/utils/build-toolchain$BUNDLE_PREFIX
where$BUNDLE_PREFIX
is a string that will be prepended to the builddate to give the bundle identifier of the toolchain'sInfo.plist
. Forinstance, if$BUNDLE_PREFIX
wascom.example
, the toolchainproduced will have the bundle identifiercom.example.YYYYMMDD
. Itwill be created in the directory you run the script with a filenameof the form:swift-LOCAL-YYYY-MM-DD-a-osx.tar.gz
.
Beyond building the toolchain,build-toolchain
also supports thefollowing (non-exhaustive) set of useful options:
--dry-run
: Perform a dry run build. This is off by default.--test
: Test the toolchain after it has been compiled. This is off by default.--distcc
: Use distcc to speed up the build by distributing the C++ part ofthe swift build. This is off by default.--sccache
: Use sccache to speed up subsequent builds of the compiler bycaching more C++ build artifacts. This is off by default.
More options may be added over time. Please pass--help
tobuild-toolchain
to see the full set of options.
On macOS if one wants to install such a toolchain into Xcode:
- Untar and copy the toolchain to one of
/Library/Developer/Toolchains/
or~/Library/Developer/Toolchains/
. E.g.:
$ sudo tar -xzf swift-LOCAL-YYYY-MM-DD-a-osx.tar.gz -C / $ tar -xzf swift-LOCAL-YYYY-MM-DD-a-osx.tar.gz -C~/
The script also generates an archive containing debug symbols whichcan be installed over the main archive allowing symbolication of anycompiler crashes.
$ sudo tar -xzf swift-LOCAL-YYYY-MM-DD-a-osx-symbols.tar.gz -C / $ tar -xzf swift-LOCAL-YYYY-MM-DD-a-osx-symbols.tar.gz -C~/
- Specify the local toolchain for Xcode's use via
Xcode->Toolchains
.
Try the suggestions inTroubleshooting build issues.
Make sure you are using thecorrect releaseof Xcode.
If you have changed Xcode versions but still encounter errors that appear tobe related to the Xcode version, try passing--clean
tobuild-script
.
When a new version of Xcode is released, you can update your build withoutrecompiling the entire project by passing--reconfigure
tobuild-script
.
Be sure to look at thedocumentation index for a bird's eyeview of the available documentation. In particular, the documents titledDebugging the Swift Compiler andContinuous Integration for Swift are veryhelpful to understand before submitting your first PR.
About
The Swift Programming Language