Swift: remove duplicates from array
By somaria
2022-12-11
import Cocoa /* Create an array of 5 intergers with duplicate values */ let array = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5] print(array) /* remove duplicate values from the array */ let set = Set(array) print(set)

Output

[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]

[4, 1, 5, 2, 3]