Releases: RougeWare/Swift-Optional-Tools
1.2 • Typed throws for `.unwrappedOrThrow()`
This package's version 1.0 in 2019 simply contained .unwrappedOrThrow()
and nothing else. The idea was simple: you place this after an Optional
value, and if that value is nil
, then it throws whatever error you give it, otherwise it returns that value. Like !
/.unsafelyUnwrapped
, but safer by using error-handling instead of potentially crashing.
Back then, there was no way to specify the type being thrown, and protocol-types weren't boxed the same if passed to something just taking that protocol's base type.
Now in Swift 6, not only is a bare protocol base type implicitly any
, you can specify the type of a throws
!
This release both uses the strong-generics typesystem to specify the type at compiletime, and also uses that type in the throws
of this function!
All previous functionality and contracts remain exactly the same with this release; it just compiles much nicer and lets you use typed-throws. Hurray!
1.1.3 - Operators for Optionals
Added three new operators:
-?
- If both have values, performsleft - right
. Otherwise, returnsnil
+?
- If both have values, performsleft + right
. Otherwise, returnsnil
=?
- If the right has a value, performsleft = right
. Otherwise, does nothing
Patch Changes
- 1.1.3
- Added a dynamic library product whose name is a valid bundle identifier
- Deprecated previous dynamic library product because its name caused problems when submitting to the App Store
- 1.1.2
- Added alternative dynamic library product
- 1.1.1
- Added dual licenses
1.0.0 - MVP
Just .unwrappedOrThrow()
for now 👍🏼