struct Numbers {
var list: [String] = [
"one",
"two",
"three"
]
func returnList() -> [String] {
var sortedList: [String] = self.list.sorted()
var finalList: [String] = sortedList.insert("four", at: 0)
return finalList
}
}
finalList is inferred to be a () instead of [String]. If I specify the type [String] I get the message:
Cannot convert value of type '()' to specified type '[String]'
Why on earth?