Since Sort is deprecated in swift3, you can try this code for the maximum number of characters in the array.
let Penguin = ["as","asc","you","bce","csi","aasi","aaas","this"] let maxLen = penguin.sorted{ $0.characters.count > $1.characters.count} print(maxLen)
The result should be ["aasi", "aaas", "this", "asc", "you", "bce", "csi", "as"]
source share