语言

Swift 快速参考

Swift 快速参考 的可打印速查表,适合快速查阅、学习和桌边参考

来源
Swift Documentation (swift.org)
许可证
MIT
更新时间
2026-03-27

示例

速查表包含什么

  • 基础
  • 类型
  • 控制流
  • 函数
  • 闭包
  • 类与结构体
  • Protocol
  • Optional
  • 枚举
  • 错误处理

Hello World

import Foundation
print("Hello, World!")

常量与变量

let name = "Swift"       // constant (immutable)
var count = 0            // variable (mutable)
count += 1
let pi: Double = 3.14   // explicit type annotation

注释

// single-line comment
/* multi-line
   comment */
/// documentation comment (Markdown supported)

下载完整速查表,获取所有章节的打印排版版本

下载 PDF

下载

选择适合你阅读方式的版本