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
🕓 1 year ago
iOS
.package(url: "https://github.com/AndreasVerhoeven/AveSwiftHelpers.git", from: "1.0.0")

AveSwiftHelpers

A collection of swift helpers

isEmptyOrNil

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 {
  print("Empty")
}

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==.

GitHub

link
Stars: 0
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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