How should I reason when I have to choose between a class, struct and enum in Swift?

前端 未结 7 1818
感情败类
感情败类 2020-12-08 07:16

Since classes, structs and enums all has constructors, properties and computed properties, how should I reason when choosing between them?

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 07:40

    Besides the advice on the practical usage of class, struct and enum, here is the comparison that clarifies the abilities among them Swift Classes, Structs, Enums, and Tuples compared

    enter image description here

提交回复
热议问题