3 ms·
Tuples are used for multiple returns in swift. So a function definition might look like: () -> (Int, String) (Function that takes no parameters, returns
by interpol_p 12y ago
Tuples are used for multiple returns in swift.
So a function definition might look like:
() -> (Int, String)
(Function that takes no parameters, returns an Int/String tuple)
Edit: Tuples can also have named parameters, so something like this is possible:
() -> (index: Int, name: String)
Then the resulting tuple can be accessed by name:
//Where x is a tuple returned from the above function
x.index
x.name