swift - Removing object from Array -
how can remove specific object array of string.
array = ["mac","iphone","ipad"] is there method delete specific string in array, example wanted remove "iphone", without using removeatindex(1)
use filter purpose
var array = ["mac","iphone","ipad"] array = array.filter() { $0 != "mac" } print(array) // print ["iphone", "ipad"]
Comments
Post a Comment