Let's say I have a Swift object called Animal. I have an array of Animal objects, some of which could be nil.
Currently I'm doing this:
arrayOfAnimal.filter({$0 != nil}) as! [Animal]
This feels rather hacky because of the force unwrapping. Wondering if there's a better way to filter out nils.