> On Jun 14, 2016, at 8:42 PM, Steve Mills <sjmi...@mac.com> wrote:
> 
>> On Jun 14, 2016, at 19:45, Charles Srstka <cocoa...@charlessoft.com 
>> <mailto:cocoa...@charlessoft.com>> wrote:
>> 
>> if thisArray.empty { doSomething() }
> 
> That's not what he suggested as the 2nd form. Look again.
> 
> Steve via iPad

Except that it is. The property name, rather than the getter, is what is 
expected to be used when you’re using dot syntax (and I think when calling from 
Swift, it’s the only way to do it).

Prepending the property name with “is” is much more clear as to what you mean, 
and it’s what Apple’s recommending these days (in the Swift guidelines, but 
that’s clearly where the future is). This helps avoid confusing things like 
NSURL’s .fileURL property, which is easy to scratch your head at wondering if 
it will query whether or not the URL is a file URL or whether it will return a 
converted URL (it doesn’t help that filePathURL’s name is so similar). 
isFileURL conveys the intent perfectly.

Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to