Swift Generics Tutorial: Getting Started | raywenderlich.com

Learn to write functions and data types while making minimal assumptions. Swift generics allow for cleaner code with fewer bugs.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3535703-swift-generics-tutorial-getting-started

First of all thanks for this awesome tutorial :clap:

In Writing a Generic Data Structure section you defined Queue and mentioned that:
Queue<Int> and Queue<String> will become concrete types of their own at runtime, that can only enqueue and dequeue strings and integers, respectively.

which I think should be:
Queue<Int> and Queue<String> will become concrete types of their own at runtime, that can only enqueue and dequeue integers and strings, respectively.

so that the Queue<Int> can enqueue and dequeue integers & the Queue<String> can enqueue and dequeue strings.

Yes, that makes more sense :slight_smile: We’ll clean it up in the next rev of the tutorial.

Hi
Thank you for this tutorial. It has good content.
It would have been more helpful if the ‘Type’ metaType as in ‘T.Type’ which is seen in many generics related code would have also been explained.
Nice tutorial though.
Thank You

@shrutisharma Thank you for the heads up - much appreciated!

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!