Skip to content

Instantly share code, notes, and snippets.

@Bellaposa
Created June 5, 2020 09:55
Show Gist options
  • Save Bellaposa/312056d88be8cf61cdaebe68d4667fbe to your computer and use it in GitHub Desktop.
Save Bellaposa/312056d88be8cf61cdaebe68d4667fbe to your computer and use it in GitHub Desktop.
ArrayExtension
extension Array {
/// filter(operation: NSPredicate)
/// - Parameter operation: NSPredicate
/// - Returns: array filtered according to operation NSPredicate
public func filter(operation: NSPredicate) -> [Element]? {
let array = NSArray(array: self)
return array.filtered(using: operation) as? [Element]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment