SwifterSwift /SwifterSwift
A handy collection of more than 500 native Swift extensions to boost your productivity.
★ 15,261⑂ 1,659👁 269⑃ 884● 355▤ 55
+2
日增长
+11
周增长
+35
月增长
15,261
stars
1,659
forks
269
watchers
884
prs
355
issues
55
releases
README
SwifterSwift
Small, self-contained Swift extensions for the standard library, Foundation, UIKit, AppKit and other Apple frameworks.
Each extension lives in its own file and depends only on the standard library and Apple's frameworks, never on another part of SwifterSwift. Use the whole library, pick the areas you need, or copy a single file into your project.
Highlights
- Self-contained. One extension per file, with no shared helpers, so any file can be copied on its own.
- Tested. Every extension has its own Swift Testing suite, including edge cases such as empty input, Unicode, other locales and time zones.
- Documented. Every extension has a documentation comment with an example, and the full reference is built with DocC.
- Modular. One product per area, plus a SwifterSwift product that includes them all.
- Cross-platform. Apple platforms, plus Linux, Android, WebAssembly and Windows for the areas available there.
Requirements
| | Minimum version |
|---|---|
| Swift | 6.2 (Xcode 26) |
| iOS, iPadOS | 17 |
| macOS | 14 |
| Mac Catalyst | 17 |
| tvOS | 17 |
| watchOS | 10 |
| visionOS | 1 |
The standard library and Foundation areas also build on Linux, Android, WebAssembly and Windows.
Installation
SwifterSwift is distributed with Swift Package Manager.
Package.swift
Add the package to your dependencies:
swift
dependencies: [
.package(url: "https://github.com/SwifterSwift/SwifterSwift.git", from: "9.0.0")
]
Then add the products you need to your target:
swift
.target(
name: "MyApp",
dependencies: [
.product(name: "SwifterSwift", package: "SwifterSwift")
]
)
Xcode
Choose File › Add Package Dependencies…, enter https://github.com/SwifterSwift/SwifterSwift.git, and select the products to add to your target.
Quick start
swift
import SwifterSwift
let numbers = [10, 20, 30]
numbers[safe: 3] // nil
let url = URL(string: "https://example.com/search?q=swift")!
url.queryValue(for: "q") // "swift"
let frame = CGRect(x: 0, y: 0, width: 100, height: 50)
frame.center // (50.0, 25.0)
Products
| Product | Extends | Platforms |
|---|---|---|
| SwifterSwift | Everything below | All |
| SwifterSwiftStdlib | The Swift standard library | All |
| SwifterSwiftFoundation | Foundation | All |
| SwifterSwiftCoreGraphics | Core Graphics and Core Animation | Apple platforms |
| SwifterSwiftUIKit | UIKit | iOS, iPadOS, Mac Catalyst, tvOS, visionOS, and watchOS where UIKit types exist |
| SwifterSwiftAppKit | AppKit | macOS |
| SwifterSwiftCoreLocation | Core Location | Apple platforms |
| SwifterSwiftMapKit | MapKit | Apple platforms |
| SwifterSwiftSpriteKit | SpriteKit | Apple platforms |
| SwifterSwiftCryptoKit | CryptoKit | Apple platforms |
| SwifterSwiftHealthKit | HealthKit | iOS, iPadOS, macOS, watchOS, visionOS |
Every product builds on every platform. Where a framework isn't available, its product is empty.
[!NOTE]
The SwifterSwift and SwifterSwiftHealthKit products link HealthKit. If your app doTop issues
#967Future of SwifterSwift7 comments · 2021-06-27#186Looking for new contributors!6 comments · 2017-07-08#1080Limitations of DateExtensions calendar property4 comments · 2023-03-02#1242There is something wrong with the method. func truncated(toLength length: Int, trailing: String? = "...")3 comments · 2025-08-27#1228crash3 comments · 2024-12-13#1196StringExtensions ~= bug3 comments · 2024-05-29#845FileManager jsonFromFile only support json dictionary3 comments · 2020-05-18#1255Add syntax highlighting to Quick Help (aka HeaderDocs) code examples2 comments · 2026-02-20
Discussions
#1204What are the errors in my code and how can I make the pawn change its position in the console?0 comments · 2024-08-11#11476.0.00 comments · 2023-10-13#11445.3.0 version breaks macOS, but master works1 comments · 2023-10-11#1096Ideas for swift apps0 comments · 2023-03-14#1072How I can create an AI in Swift Playground on iPad?1 comments · 2023-01-19#1040Xcode imageLiteral1 comments · 2022-08-25#10295.3.01 comments · 2022-08-01#995Am New to Xcode0 comments · 2021-10-23
Latest release
8.0.0 8.0.0 2025-08-26This release brings many great improvements and bug fixes. Thanks to our awesome contributors! For a complete list of changes, please refer to the CHANGELOG.