Tuple Types | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Tuple Types

Hi, quick question: When it comes to types in swift, for iterables there is a “full” version, so for arrays you can have Array<String>, for dictionaries Dictionary<Int,String> and so on. I was wondering if there is an equivalent for tuples, and if so what is it (or is it just Tuple<types>). Thanks in advance

22nd Apr 2022, 8:15 PM
Kamil Hamid
Kamil Hamid - avatar
4 Answers
+ 1
In Swift, a tuple is a group of different values. And, each value inside a tuple can be of different data types.
6th May 2022, 2:19 PM
NoVa
NoVa - avatar
+ 1
As I mentioned, They accept different types, And as far as I know you cannot use Tuple<types>
6th May 2022, 3:57 PM
NoVa
NoVa - avatar
0
Not quite my question
6th May 2022, 3:21 PM
Kamil Hamid
Kamil Hamid - avatar
0
As can arrays and dictionaries (hence the Any keyword)
6th May 2022, 3:57 PM
Kamil Hamid
Kamil Hamid - avatar