Question : swift check if array values are equal
Answered by : phil-w8jrzk604pj8
let array = [1, 1, 1]
let hasAllItemsEqual = array.dropFirst().allSatisfy({ $0 == array.first })
print(hasAllItemsEqual) // prints: true
Source : https://stackoverflow.com/questions/29588158/check-if-all-elements-of-an-array-have-the-same-value-in-swift | Last Update : Tue, 12 Jul 22