Here are the docs for NSMutableArray remove(_ anObject: Any):
func remove(_ anObject: Any)
Removes all occurrences in the array of a given object.
This method determines a match by comparing anObject to the objects in the receiver using the isEqual: method. If the array does not contain anObject, the method has no effect (although it does incur the overhead of searching the contents).
The authors intended to remove more objects than exist in the array, but this method removes objects by comparing each element in the array to the object passed as an argument.
As mwbeatty figured out, NSMutableArray removeObject(at index: Int) is the correct method:
func removeObject(at index: Int)
The index from which to remove the object in the array. The value must not exceed the bounds of the array.
Raises an exception NSRangeException if index is beyond the end of the array.
What’s strange is there’s no error with regard to the “at:” label, which is incorrect. After digging around in Swift docs for a bit and experimenting in a playground I can only guess that it has something to do with how Swift calls Objective-C code (i.e. NSMutableArray.) I wonder if labels are ignored for Obj-C methods with only one parameter.