There are a couple of ways to return multiple values from a Swift function. One of the most common ways is to put the values into a collection type (an array or dictionary) and then return the collection. The following example shows how to return a collection type from a Swift function:
func getNames() -> [String] { var retArray = ["Jon", "Kim", "Kailey", "Kara"] return retArray } var names = getNames()
In the preceding example, we declared the getNames() function with no parameters and a return type of [String]. The return type of [String] specifies the return type to be an array of string types.
In the preceding example, our array could only return string types. If we needed to return numbers with our strings, we could return an array of the Any type and then use typecasting to specify...