What are convenience required initializers in Swift?

后端 未结 3 1038
天涯浪人
天涯浪人 2020-12-31 05:11

I saw in this answer that the user specifies a convenience required init(). What exactly does this mean?

I understand that the required key

3条回答
  •  情书的邮戳
    2020-12-31 06:06

    A class initializer can be marked with required to indicate that every subclass of the class must implement that initializer.

    As a subclass, you can use a designated initializer or a convenience initializer to satisfy this requirement.

提交回复
热议问题