Extension for array to do it easily and allow chaining for Swift 4.2 and up:
public extension Array where Element: Equatable {
@discardableResult
public mutating func remove(_ item: Element) -> Array {
if let index = firstIndex(where: { item == $0 }) {
remove(at: index)
}
return self
}
@discardableResult
public mutating func removeAll(_ item: Element) -> Array {
removeAll(where: { item == $0 })
return self
}
}