What is the Objective-C equivalent of a public get/protected set property in C#

前端 未结 3 1177
[愿得一人]
[愿得一人] 2020-12-10 11:30

Is there any way to create a property like this C# property in Objective-C?

public int prop { get; protected set;}

Essentially, I want to m

3条回答
  •  甜味超标
    2020-12-10 12:20

    I believe you are looking for the readonly attribute on the @property

    @property (readonly) NSInteger prop;
    

    Read more here.

提交回复
热议问题