> On Jun 14, 2016, at 6:48 PM, Graham Cox <[email protected]> wrote:
>
> Hi all,
>
> Just a quick point for discussion.
>
> Suppose I have a read-only BOOL property. What’s better, to declare it as:
>
> @property (readonly) BOOL isFoo;
>
> or:
>
> @property (readonly, getter=isFoo) BOOL foo;
>
>
> Is there any advantage to one over the other? n.b. I’d always use the latter
> form for read/write properties, it’s readonly ones that I’m wondering about.
>
> —Graham
The former is what Apple’s recommending in the Swift guidelines, so it’s
probably the more future-proof of the two.
I’ve always felt this style to read more naturally, too.
if thisArray.isEmpty { doSomething() } // reads as “If this array is empty, do
something."
if thisArray.empty { doSomething() } // reads as “Grok say this array empty!
Grok do something! GRARRRGH! ::conks you on the head with a club::"
Charles
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]