Last active
July 7, 2020 17:56
-
-
Save eonist/dfa1412dc70eb93b2c516b35dd0daa1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Asserter | |
*/ | |
extension Array { | |
/** | |
* Asserts if array has nil values | |
* ## Examples: | |
* let someArr: [Int?] = [1,2,nil] | |
* someArr.hasNil() // true | |
* [1,2,2].hasNil() // false | |
*/ | |
public func hasNil<T>() -> Bool where Element == T? { | |
self.contains { $0 == nil } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment