how to remove item from list swift
var animals = ["cats", "dogs", "chimps", "moose"]
// remove at specific index
animals.remove(at: 2) //["cats", "dogs", "moose"]
// remove first element
animals.removeFirst() //["dogs", "moose"]
// remove last element
animals.removeLast() //["dogs"]
// remove at unknown index
if let index = animals.firstIndex(of: "dogs") {
animals.remove(at: index)
}