tree: 66036cf32f33faae2f1d2eb7c525c5cc959ec39f [path history] [tgz]
  1. _static/
  2. _templates/
  3. ABI/
  4. archive/
  5. assets/
  6. HowToGuides/
  7. proposals/
  8. refactoring/
  9. scripts/
  10. tools/
  11. ABIStabilityManifesto.md
  12. AccessControl.rst
  13. AccessControlInStdlib.rst
  14. Android.md
  15. AndroidBuild.md
  16. ARCOptimization.rst
  17. Array.png
  18. ArrayBridge.graffle
  19. ArrayBridge.png
  20. ArrayCast.graffle
  21. ArrayCast.png
  22. ArrayImplementation.graffle
  23. ArrayImplementation.png
  24. Arrays.rst
  25. Branches.md
  26. BuildManifesto.md
  27. ByteTree.md
  28. CMakeLists.txt
  29. CompilerPerformance.md
  30. conf.py
  31. contents.rst
  32. ContiguousArray.png
  33. ContinuousIntegration.md
  34. CppInteroperabilityManifesto.md
  35. CToSwiftNameTranslation-OmitNeedlessWords.md
  36. CToSwiftNameTranslation.md
  37. DebuggingTheCompiler.md
  38. DependencyAnalysis.md
  39. DevelopmentTips.md
  40. Diagnostics.md
  41. DifferentiableProgramming.md
  42. DocumentationComments.md
  43. doxygen.cfg.in
  44. doxygen.css
  45. doxygen.footer
  46. doxygen.header
  47. doxygen.intro
  48. Driver.md
  49. DriverInternals.md
  50. DriverParseableOutput.md
  51. DynamicCasting.md
  52. ErrorHandling.rst
  53. ErrorHandlingRationale.rst
  54. ExternalResources.md
  55. FailableInitializers.rst
  56. favicon.ico
  57. Generics.rst
  58. GenericsManifesto.md
  59. GitHubCreatePRScreenshot.png
  60. HighLevelSILOptimizations.rst
  61. HowSwiftImportsCAPIs.md
  62. IndexInvalidation.md
  63. InitializerProblems.rst
  64. InstrumentsExpandedProfile.png
  65. InstrumentsProfile.png
  66. Lexicon.md
  67. libFuzzerIntegration.md
  68. LibraryEvolution.rst
  69. LibraryEvolutionManifesto.md
  70. Literals.md
  71. LogicalObjects.md
  72. Makefile
  73. Modules.rst
  74. MutationModel.rst
  75. ObjCInterop.md
  76. OpenBSD.md
  77. OptimizationTips.rst
  78. OptimizerCountersAnalysis.md
  79. OptimizerDesign.md
  80. OwnershipManifesto.md
  81. PerfReport.png
  82. Random.md
  83. README.md
  84. RefcountingStates.graffle
  85. RequestEvaluator.md
  86. Runtime.md
  87. SequencesAndCollections.rst
  88. Serialization.md
  89. SIL.rst
  90. SILProgrammersManual.md
  91. Slice.png
  92. StableBitcode.md
  93. StandardLibraryProgrammersManual.md
  94. StdlibAPIGuidelines.rst
  95. StdlibRationales.rst
  96. StoredAndComputedVariables.rst
  97. StringDesign.rst
  98. StringManifesto.md
  99. Swift3Compatibility.md
  100. SwiftIndent.md
  101. Testing.md
  102. TextFormatting.rst
  103. toc.js
  104. TransparentAttr.md
  105. TypeChecker.md
  106. weak.rst
  107. WebAssembly.md
  108. Windows.md
  109. WindowsBuild.md
  110. WindowsCrossCompile.md
docs/README.md

Documentation Index

This page describes the overall organization of documentation for the Swift toolchain. It is divided into the following sections:

  • Tutorials gently guide you towards achieving introductory tasks, while assuming minimal background knowledge.
  • How-To Guides help you complete specific tasks in a step-by-step fashion.
  • Explanations discuss key subsystems and concepts, at a high level. They also provide background information and talk about design tradeoffs.
  • Reference Guides contain a thorough technical reference for complex topics. They assume some overall understanding of surrounding subsystems.
  • Recommended Practices suggests guidelines for writing code and diagnostics.
  • Project Information tracks continuous integration (CI), branching and release history.
  • Evolution Documents includes proposals and manifestos for changes to Swift.
  • The External Resources section provides links to valuable discussions about Swift development, in the form of talks and blog posts.
  • The Uncategorized section is for documentation which does not fit neatly into any of the above categories. We would like to minimize items in this section; avoid adding new documentation here.

Sometimes documentation is not enough. Especially if you are a new contributor, you might run into roadblocks which are not addressed by the existing documentation. Or they are addressed somewhere but you cannot find the relevant bits. If you are stuck, please use the development category on the Swift forums to ask for help!

Lastly, note that we are slowly moving towards a more structured form of documentation, inspired by the Django project [1] [2]. Hence parts of this page are aspirational and do not reflect how much of the existing documentation is written. Pull requests to clean up the Uncategorized section, or generally fill gaps in the documentation are very welcome. If you would like to make major changes, such as adding entire new pieces of documentation, please create a thread on the Swift forums under the development category to discuss your proposed changes.

Tutorials

How-To Guides

  • FAQ.md: Answers “How do I do X?” for a variety of common tasks.
  • FirstPullRequest.md: Describes how to submit your first pull request. This is the place to start if you're new to the project!
  • GettingStarted.md: Describes how to set up a working Swift development environment for Linux and macOS, and get an edit-build-test-debug loop going.
  • DebuggingTheCompiler.md: Describes a variety of techniques for debugging.
  • Building for Android:
    • Android.md: How to run some simple programs and the Swift test suite on an Android device.
    • AndroidBuild.md: How to build the Swift SDK for Android on Windows.
  • Building for Windows:
  • Building for OpenBSD:
    • OpenBSD.md: Overview of specific steps for building on OpenBSD.
  • RunningIncludeWhatYouUse.md: Describes how to run include-what-you-use on the Swift project.

Explanations

  • ByteTree.md: Describes the ByteTree binary format used for serializing syntax trees in libSyntax.
  • WebAssembly.md: Explains some decisions that were made while implementing the WebAssembly target.

Compiler and Runtime Subsystems

  • Driver:
    • Driver.md: Provides an overview of the driver, compilation model, and the compiler's command-line options. Useful for integration into build systems other than SwiftPM or Xcode.
    • DriverInternals.md: Provides a bird‘s eye view of the driver’s implementation.
  • DependencyAnalysis.md: Describes different kinds of dependencies across files in the same module, important for understanding incremental builds.
  • C and ObjC interoperability: Clang Importer and PrintAsObjC
  • Type-checking and inference:
    • TypeChecker.md: Provides an overview of how type-checking and inference work.
    • RequestEvaluator.md: Describes the request evaluator architecture, which is used for lazy type-checking and efficient caching.
    • Literals.md: Describes type-checking and inference specifically for literals.
  • Serialization.md: Gives an overview of the LLVM bitcode format used for swiftmodules.
    • StableBitcode.md: Describes how to maintain compatibility when changing the serialization format.
  • SIL and SIL Optimizations:
    • SILProgrammersManual.md: Provides an overview of the implementation of SIL in the compiler.
    • OptimizerDesign.md: Describes the design of the optimizer pipeline.
    • HighLevelSILOptimizations.rst: Describes how the optimizer understands the semantics of high-level operations on currency data types and optimizes accordingly. Includes a thorough discussion of the @_semantics attribute.

SourceKit subsystems

Language subsystems

  • Swift's Object Model
  • DocumentationComments.md: Describes the format of Swift's documentation markup, including specially-recognized sections.

Stdlib Design

Reference Guides

  • DriverParseableOutput.md: Describes the output format of the driver's -parseable-output flag, which is suitable for consumption by editors and IDEs.
  • ObjCInterop.md Documents how Swift interoperates with ObjC code and the ObjC runtime.
  • LibraryEvolution.rst: Specifies what changes can be made without breaking binary compatibility.
  • SIL.rst: Documents the Swift Intermediate Language (SIL).
  • DynamicCasting.md: Behavior of the dynamic casting operators is, as?, and as!.
  • Runtime.md: Describes the ABI interface to the Swift runtime.
  • Lexicon.md: Canonical reference for terminology used throughout the project.

ABI

  • GenericSignature.md: Describes what generic signatures are and how they are used in the ABI, including the algorithms for minimization and canonicalization.
  • KeyPaths.md: Describes the layout of key path objects (instantiated by the runtime, and therefore not strictly ABI).
    TODO: The layout of key path patterns (emitted by the compiler, to represent key path literals) isn't documented yet.
  • Mangling.rst: Describes the stable mangling scheme, which produces unique symbols for ABI-public declarations.
  • RegisterUsage.md: Summarizes the register allocation for ARM64 and x86_64 calling conventions, including the context register (self) and error return register.
  • TypeLayout.rst: Describes the algorithms/strategies for fragile struct and tuple layout; class layout; fragile enum layout; and existential container layout.
  • TypeMetadata.rst: Describes the fields, values, and layout of metadata records, which can be used (by reflection and debugger tools) to discover information about types.

Recommended Practices

Coding

Diagnostics

Project Information

  • Branches.md: Describes how different branches are setup and what the automerger does.
  • ContinuousIntegration.md: Describes the continuous integration setup, including the @swift_ci bot.

Evolution Documents

Manifestos

Proposals

Old proposals are present in the /docs/proposals directory. More recent proposals are located in the apple/swift-evolution repository. You can see the status of different proposals at https://apple.github.io/swift-evolution/.

Surveys

  • CallingConvention.rst: This whitepaper discusses the Swift calling convention (high-level semantics; ownership transfer; physical representation; function signature lowering).
  • ErrorHandlingRationale.rst: Surveys error-handling in a variety of languages, and describes the rationale behind the design of error handling in Swift.
  • weak.rst: Discusses weak references, including the designs in different languages, and proposes changes to Swift (pre-1.0).

Archive

These documents are known to be out-of-date and are superseded by other documentation, primarily The Swift Programming Language (TSPL). They are preserved mostly for historical interest.

External Resources

External resources are listed in ExternalResources.md. These cover a variety of topics, such as the design of different aspects of the Swift compiler and runtime and contributing to the project more effectively.

Uncategorized

Needs refactoring

The documents in this section might be worth breaking up into several documents, and linking one document from the other. Breaking up into components will provide greater clarity to contributors wanting to add new documentation.

  • ARCOptimization.rst: Covers how ARC optimization works, with several examples. TODO: Not clear if this is intended to be an explanation or a reference guide.
  • CompilerPerformance.md: Thoroughly discusses different ways of measuring compiler performance and common pitfalls. TODO: Consider breaking up into one high-level explanation explaining key concepts and individual how-to guides that can be expanded independently. Also, it's not the right place to explain details of different compiler modes.
  • DevelopmentTips.md: Contains an assortment of tips for better productivity when working on the compiler. TODO: Might be worthwhile to make a dedicated how-to guide or explanation. It might also be valuable to introduce the tips in context, and have the explanation link to all the different tips.
  • Diagnostics.md: Describes how to write diagnostic messages and associated educational notes. TODO: Consider splitting into how-tos and recommended practices. For example, we could have a how-to guide on adding a new diagnostic, and have a recommended practices page which explains the writing style for diagnostics and educational notes.
  • HowSwiftImportsCAPIs.md: Contains a thorough description of the mapping between C/ObjC entities and Swift entities. TODO: Not clear if this is intended to be language documentation (for Swift developers), an explanation or a reference guide.
  • OptimizerCountersAnalysis.md: TODO: Consider breaking up into a how-to guide on dumping and analyzing the counters and an explanation for the counter collection system.
  • Testing.md: TODO: Consider splitting into a how-to guide on writing a new test case and an explanation for how the compiler is tested.
  • SwiftIndent.md: TODO: Unclear if this is intended to be an explanation or a reference guide.
  • Random.md: Stub.

Archive