Swift
Swift 是由 Chris Lattner 主导、Apple 与开源社区共同开发的多范式编程语言,首个版本于 2014 年发布; 其设计目标是以现代语法、强类型系统与安全特性取代 Objective‑C,适用于 iOS、macOS、watchOS、tvOS、visionOS 等平台,并扩展至 Linux、Windows 等多系统环境。
Swift 自 2.2 起采用 Apache License 2.0 许可,当前版本为 6.2.3,具备静态强类型、自动引用计数(ARC)、协议导向编程、并发模型等特性,支持从嵌入式设备到服务器端的多场景开发。
Install Swift
Install Swift on Windows
Run following in PowerShell 7:
winget install --id Microsoft.VisualStudio.2022.Community --exact --force --custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22621 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
Install Swift and other dependencies: winget install --id Swift.Toolchain -e
Get swift version: swift --version
See also:
- Setup VSCode code formatter: swiftformat
ref: https://www.swift.org/install/windows/
Create a swift package
shell
swift package init --type library
xed .