Swiftpack.co - AndreasVerhoeven/AveSwiftHelpers as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by AndreasVerhoeven.
AndreasVerhoeven/AveSwiftHelpers 1.0.0
Common Helper methods for Swift
⭐️ 0
🕓 6 weeks ago
.package(url: "https://github.com/AndreasVerhoeven/AveSwiftHelpers.git", from: "1.0.0")


A collection of swift helpers


isEmptyOrNil adds a helper function to both Optional and Collection that can be used to easily check if a (optional chained) collection is empty or nil:

if someObject?.someVariable?.someCollection.isEmptyOrNil == true {

This is not super trivial to do, since if you add a extension on Optional for isEmptyOrNil: Bool, this will fail when optional chaining is involved, since you would be comparing Bool? == true, which is always false. isEmptyOrNil makes this work by using a custom Bool type as return, which has a custom operator==.


Stars: 0
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics