What does <> (angle brackets) do on class names in swift? -


in class declaration use of <> angle brackets , parameters declared inside in swift? as:

public class classname<t: comparable> {   } 

it makes class generic. swift standard library doesn't have lot of examples of generic classes, has well-known generic structs , enums:

public struct array<element> : collectiontype, mutablecollectiontype, _destructorsafecontainer  public struct dictionary<key : hashable, value> : collectiontype, dictionaryliteralconvertible  public enum optional<wrapped> : _reflectable, nilliteralconvertible 

read more generics under “generics” in the swift programming language.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -