You can convert to a Set
and back to an Array
again quite easily:
let unique = Array(Set(originals))
This is not guaranteed to maintain the original order of the array.
More Related Contents:
- Why does the reverse() function in the Swift standard library return ReverseRandomAccessCollection?
- how to check if there is any string from index 0 to 5 in an array of type Any [closed]
- remove an index number from array
- How to find index of list item in Swift?
- Get random elements from array in Swift
- Swift: Creating an Array with a Default Value of distinct object instances
- Why isn’t [SomeStruct] convertible to [Any]?
- How can I extend typed Arrays in Swift?
- Making my function calculate average of array Swift
- Converting a C char array to a String
- Sorting a Swift array by ordering from another array
- Confused about Swift Array Declarations
- Finding sum of elements in Swift array
- Swift 3.0: compiler error when calling global func min(T,T) in Array or Dictionary extension
- Count the occurences a particular integer has in an array [duplicate]
- Find min / max value in Swift Array
- type any? has no subscript members
- How to split a string by new lines in Swift
- Creating an extension to filter nils from an Array in Swift
- Convert bytes/UInt8 array to Int in Swift
- Compare arrays in swift
- Swift: What’s the best way to pair up elements of an Array
- Multidimensional arrays in Swift
- Extending Array to check if it is sorted in Swift?
- New Array from Index Range Swift
- Iterate over two arrays simultaneously
- In Swift how can I sort one array based on another array?
- How to forward functions with variadic parameters?
- Concatenate Swift Array of Int to create a new Int
- Swift: Binary search for standard array?