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() and AppInfo.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:

Keep reading

Read more

3 min read Variadic Parameters Read article 3 min read GeometryReader in SwiftUI Read article 4 min read Translating closures to async Read article

Share

Share this article

Share Bluesky Mastodon Twitter LinkedIn Facebook