KB Tag: generics

  • How to use Generics in iOS swift

    Generics are an interesting concept, and they permit you to reuse your code for several types. Let’s stare at an example: func swapInts(_ a: inout Int, _ b: inout Int) {     let temporaryB = b     b = a     a = temporaryB } swapInts function obtains 2 Ints and swaps them. Here is a sample usage:…