Swift Weekly – Issue 06 – The Swift Runtime (Part 4) – Generics

Generics are pretty cool. They let us do complicated stuff that many programmers don’t want to deal with sometimes and want to stick with traditional means of achieving the same goals but using basic ideas in OOP. In this edition of Swift Weekly, I won’t teach you about generics eventhough you may just see the examples and learn generics anyways. What I will teach you however is how generics are compiled at the assembly level buy the Swift compiler.

I am going to use the release version of the code to make sure the output assembly is as optimized as possible so that the optimization level is set to -O in the output when your Swift files are being compiled. Also my swift -versionshows this:

Swift version 1.1 (swift-600.0.54.20)
Target: x86_64-apple-darwin14.0.0

I am using the latest beta of Xcode, aka Version 6.2 (6C86e). Let’s get started.

Note: I am going to get rid of some of the assembly code that is not relevant to the main point of this week’s objective.

Continue reading this article on GitHub.