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
Post a Comment