Rapid

3.0.0

A host of utilities to make Swift Swiftier — mirror for https://codeberg.org/kaascevich/rapid
kaascevich/Rapid

What's New

Rapid 3.0.0

2024-09-08T23:19:20Z

Hello, I still exist! Sorry for not updating for... oh my god, has it actually been a year and a week since I last made a release?

A bunch of this update is dedicated to bringing Rapid up-to-date with all the fancy-schmancy newness of Swift 6.

Full Changelog: v2.3.0...v3.0.0

Additions

  • ~= operator for Regex
  • !! operator for calling a never-returning function when optional unwrapping fails
  • AnyType and Nothing typealiases for Any.Type and Void, respectively
  • sum() and product() methods for Numeric sequences
  • compacted() method for Sequence
  • ** and **= operators
  • ExpressibleByEmptyArrayLiteral and ExpressibleByEmptyDictionaryLiteral protocols

Updates

  • Updated ?! operator with typed throws

Deprecations

  • There's now a count(where:) method in the standard library, rendering one of Rapid's count(of:) methods obsolete. This method has thus been deprecated, and will be removed in Rapid 4.
    • count(where:) should work as a drop-in replacement for your projects -- and if you were using trailing closures, you might not even have to update your code at all!
    • The overload of count(of:) that takes an element instead of a predicate was kept, since the standard library doesn't have a direct equivalent to it (yet).

Removals

  • ++, --, &++, and &-- operators

Breaking Changes

  • Changed the count parameter of String.*(_:_:) to be a UInt instead of an Int

Other

  • Changed license from the GNU GPL v3 to the MIT License
    • What this practically means is that, from this version (3.0.0) onwards, Rapid can now legally be used in software that isn't open source (as well as some other things that stem from or alongside this). No existing users should be affected by this change.
  • General documentation polish
  • Migrated tests from Quick/Nimble to swift-testing

Rapid

Swift Compatibility Platform Compatibility

A host of utilities to make Swift Swiftier.

What's this about?

Rapid is a package containing many of the most common extensions to the standard library (and, occasionally, other frameworks).

Within Rapid, you will find:

  • Operators for the most commonly used features, such as § to create String representations
  • Unicode versions of built-in operators, such as instead of !=
  • Property wrappers, such as @Transformed or @Clamped
  • Global constants for commonly used values, such as π for Double.pi
  • Computed properties to simplify common comparisons, such as isNil or isNotEmpty
  • Inverted versions of methods, such as last(where:) or noneSatisfy(_:)
  • Syntactic sugar for working on specific values, such as configure(_:_:) or run(with:do:)
  • Methods and subscripts that return nil instead of crashing when invalid arguments are passed
  • And more...

Using Rapid

Using in a Swift package

  1. Add Rapid to your package manifest:

    .package(
        url: "https://github.com/kaascevich/Rapid.git",
        branch: "main"
    )
  2. Add Rapid as a dependency for each of your targets:

    .product(
        name: "Rapid",
        package: "Rapid"
    )

Using in an Xcode project

  1. Choose FileAdd Package Dependencies...
  2. Copy this link, and paste it into the search bar.
  3. Click Add Package.
  4. Choose the target you want to add Rapid to, and then click Add Package again.

Documentation

I've documented everything to the best of my ability. However, due to an issue with the Swift Package Index, you'll need to build it yourself for now. Dunno when they fixed it, but they did! You can find it here.

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

Last updated: Thu May 15 2025 12:13:45 GMT-0900 (Hawaii-Aleutian Daylight Time)