Swift Package: SwiftExtras
In this post, we will explore the SwiftExtras
Swift Package, a package that provides additional functionality and utilities for Swift developers.
What is SwiftExtras
?
SwiftExtras
is a Swift package that offers a collection of useful extensions, utilities, and helper functions to enhance the Swift programming experience. It aims to fill in the gaps and provide commonly needed functionality that may not be available in the standard library.
Installation
To install SwiftExtras
, you can use the Swift Package Manager. Add the following line to your Package.swift
file:
.package(url: "https://github.com/0xWDG/SwiftExtras", branch: "main")
Then, add SwiftExtras
to the dependencies of your target:
.target(
name: "YourTarget",
dependencies: ["SwiftExtras"]
)
Features
Versatile Extensions & Helpers
SwiftExtras offers enhancements across a wide range of Swift types as String
, Date
, Color
, View
, Error
.
Cross-Platform SwiftUI Utilities
The package includes ready-to-use SwiftUI components like IndexedList
, MonthYearPickerView
, and other layout structures—built for seamless integration across iOS, macOS, tvOS, and watchOS.
e.g. but not limited to:
-
IndexedList(data:rowContent:)
-
Error.errorCode
-
AppInfo.openAppStorePage()
andAppInfo.isLatestVersion()
-
String.clean()
(for removing diacritics) -
.longPress(action:)
for views -
MonthYearPickerView()
-
String.containsHTML
&String.htmlToAttributedString()
Read the documentation for more information on how to use these features.
Conclusion
In this post, we explored the SwiftExtras
Swift Package, a powerful tool for enhancing the Swift programming experience. We covered the installation process, usage examples, and potential use cases for this package. With SwiftExtras
, you can easily work with common tasks and integrate them into your Swift applications.
Resources:
Read more
- OTP Code Generation with CryptoKit: A Swift Approach • 3 minutes reading time.
- Creating macOS Menu Bar App in SwiftUI • 4 minutes reading time.
- Simplifying Game Controller Integration with GameControllerKit • 5 minutes reading time.
Share
Share Bluesky Mastodon Twitter LinkedIn Facebook