Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Question about collection

dickthedevdickthedev Posts: 214Registered Users @ @
Hello, I have a question.
I want to get my Swift terminologies straight.
As I understand, Swift has three collection types-Array, Dictionary and Set. But I don't why Tuples be also a collection type? Since tuples can contain mixed types. Thanks.

Replies

  • BrianSlickBrianSlick Treadmill Desk Ninja Posts: 10,689Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
    edited May 3
    In addition to my previous answer to your similar question, you can't expand a tuple. A tuple is more like a struct than a collection. If you get an array of 3 items, you can append more data and get a total of 10 items. You can't do that with a tuple. A tuple defined as having 3 items will only ever have 3 items. You cannot append more data. You would have to change the definition of the tuple to have 10 items. Similarly you can't remove data from a tuple, and make it have 2 items now. Again you'd have to change the definition of the tuple.
    Professional iOS App Development. Available for hire.
    BriTer Ideas LLC - WWW | Facebook | Twitter | LinkedIn

    BTIKit | BTICoreDataKit | SlickShopper 2 | Leave a PayPal donation
  • dickthedevdickthedev Posts: 214Registered Users @ @
    Oh, I see . Thanks for you explaination. :) So the definition
    of collection is that it has to be mutable without re-defining.
Sign In or Register to comment.