# \[Idea\] Make Boolean @objc properties reflect better into Objective-C

**URL:** <https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538>\
**Category:** Discussion\
**Created:** [February 23, 2016, 9:00pm UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538 "2016-02-23T21:00:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Douglas\_Gregor](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/douglas_gregor/32/1362_2.png) [@Douglas\_Gregor](https://forums.swift.org/u/Douglas_Gregor)\
**Post date:** [February 23, 2016, 9:00pm UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538/1 "2016-02-23T21:00:01Z")

</div>

Hi all,

The Swift API guidelines state that Boolean properties should reflect assertions about the receiver, so in Swift one would expect:

&nbsp;&nbsp;class Foo {  
&nbsp;&nbsp;&nbsp;&nbsp;var isEnabled: Bool // good  
&nbsp;&nbsp;}

rather than

&nbsp;&nbsp;class Foo {  
&nbsp;&nbsp;&nbsp;&nbsp;var enabled: Bool // not Swifty  
&nbsp;&nbsp;}

When the property is @objc, e.g.,

&nbsp;&nbsp;class Foo : NSObject {  
&nbsp;&nbsp;&nbsp;&nbsp;@objc var isEnabled: Bool  
&nbsp;&nbsp;}

The resulting Objective-C property doesn’t follow the Cocoa guidelines for Objective-C \<[Naming Properties and Data Types](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-BAJGIIJE&gt;:)

&nbsp;&nbsp;@property (readwrite,nonatomic) BOOL isEnabled;

because those guidelines state that properties do not use the “is” prefix.

My proposal is to strip the “is” prefix from the Objective-C name, but leave it off the getter, e.g.,

&nbsp;&nbsp;@property (readwrite,nonatomic,getter=isEnabled) BOOL enabled;

The change would have no effect on the Swift name; it will only affect the Objective-C property name and setter name.

Thoughts?

&nbsp;&nbsp;- Doug

---

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [February 23, 2016, 9:10pm UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538/2 "2016-02-23T21:10:11Z")

</div>

+1 from me.

> **···**
>
> > On Feb 23, 2016, at 13:00, Douglas Gregor via swift-evolution \<swift-evolution@swift.org\> wrote:
> > 
> > Hi all,
> > 
> > The Swift API guidelines state that Boolean properties should reflect assertions about the receiver, so in Swift one would expect:
> > 
> > &nbsp;&nbsp;class Foo {  
> > &nbsp;&nbsp;&nbsp;&nbsp;var isEnabled: Bool // good  
> > &nbsp;&nbsp;}
> > 
> > rather than
> > 
> > &nbsp;&nbsp;class Foo {  
> > &nbsp;&nbsp;&nbsp;&nbsp;var enabled: Bool // not Swifty  
> > &nbsp;&nbsp;}
> > 
> > When the property is @objc, e.g.,
> > 
> > &nbsp;&nbsp;class Foo : NSObject {  
> > &nbsp;&nbsp;&nbsp;&nbsp;@objc var isEnabled: Bool  
> > &nbsp;&nbsp;}
> > 
> > The resulting Objective-C property doesn’t follow the Cocoa guidelines for Objective-C \<[Naming Properties and Data Types](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-BAJGIIJE&gt;:)
> > 
> > &nbsp;&nbsp;@property (readwrite,nonatomic) BOOL isEnabled;
> > 
> > because those guidelines state that properties do not use the “is” prefix.
> > 
> > My proposal is to strip the “is” prefix from the Objective-C name, but leave it off the getter, e.g.,
> > 
> > &nbsp;&nbsp;@property (readwrite,nonatomic,getter=isEnabled) BOOL enabled;
> > 
> > The change would have no effect on the Swift name; it will only affect the Objective-C property name and setter name.
> > 
> > Thoughts?
> > 
> > &nbsp;&nbsp;- Doug
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-evolution mailing list  
> > swift-evolution@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![dabrahams](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dabrahams/32/9815_2.png) [@dabrahams](https://forums.swift.org/u/dabrahams)\
**Post date:** [February 23, 2016, 10:25pm UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538/3 "2016-02-23T22:25:32Z")

</div>

+1

> **···**
>
> on Tue Feb 23 2016, Douglas Gregor \<swift-evolution@swift.org\> wrote:
> 
> > My proposal is to strip the “is” prefix from the Objective-C name, but leave it off the getter, e.g.,
> > 
> > &nbsp;&nbsp;@property (readwrite,nonatomic,getter=isEnabled) BOOL enabled;
> > 
> > The change would have no effect on the Swift name; it will only affect the Objective-C property name and setter name.
> > 
> > Thoughts?
> 
> --  
> -Dave

---

<div class="post-metadata">

**Author:** ![SlaunchaMan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/slaunchaman/32/520_2.png) [@SlaunchaMan](https://forums.swift.org/u/SlaunchaMan)\
**Post date:** [February 23, 2016, 9:02pm UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538/4 "2016-02-23T21:02:26Z")

</div>

+1. This definitely matches my real-world use of boolean properties across  
both languages.

Jeff Kelley

SlaunchaMan@gmail.com | @SlaunchaMan \<[https://twitter.com/SlaunchaMan&gt](https://twitter.com/SlaunchaMan&gt); |  
jeffkelley.org

> **···**
>
> On Tue, Feb 23, 2016 at 4:00 PM, Douglas Gregor via swift-evolution \< swift-evolution@swift.org\> wrote:
> 
> > Hi all,
> > 
> > The Swift API guidelines state that Boolean properties should reflect  
> > assertions about the receiver, so in Swift one would expect:
> > 
> > class Foo {  
> > &nbsp;&nbsp;var isEnabled: Bool // good  
> > }
> > 
> > rather than
> > 
> > class Foo {  
> > &nbsp;&nbsp;var enabled: Bool // not Swifty  
> > }
> > 
> > When the property is @objc, e.g.,
> > 
> > class Foo : NSObject {  
> > &nbsp;&nbsp;@objc var isEnabled: Bool  
> > }
> > 
> > The resulting Objective-C property doesn’t follow the Cocoa guidelines  
> > for Objective-C  
> > \<[Naming Properties and Data Types](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-BAJGIIJE&gt);  
> > :
> > 
> > @property (readwrite,nonatomic) BOOL isEnabled;
> > 
> > because those guidelines state that properties do not use the “is” prefix.
> > 
> > My proposal is to strip the “is” prefix from the Objective-C name, but  
> > leave it off the getter, e.g.,
> > 
> > @property (readwrite,nonatomic,getter=isEnabled) BOOL enabled;
> > 
> > The change would have no effect on the Swift name; it will only affect the  
> > Objective-C property name and setter name.
> > 
> > Thoughts?
> > 
> > - Doug
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-evolution mailing list  
> > swift-evolution@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![Radek\_Pietruszewski](https://avatars.discourse-cdn.com/v4/letter/r/74df32/32.png) [@Radek\_Pietruszewski](https://forums.swift.org/u/Radek_Pietruszewski)\
**Post date:** [February 24, 2016, 8:36am UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538/5 "2016-02-24T08:36:05Z")

</div>

Seems like an easy win, so I’m leaning towards a +1.

OTOH, are there any other cases where Swift -\> ObjC automatically changes names of things to optimize for ObjC? If we don’t do more of that (the '"Add needless words" to Objective-C method names’ thread, or other quick wins like this one), it would be weird to make just this one exception, a single special case. I fear this would be more surprising than not changing anything at all.

— Radek

> **···**
>
> > On 23 Feb 2016, at 22:00, Douglas Gregor via swift-evolution \<swift-evolution@swift.org\> wrote:
> > 
> > Hi all,
> > 
> > The Swift API guidelines state that Boolean properties should reflect assertions about the receiver, so in Swift one would expect:
> > 
> > &nbsp;&nbsp;class Foo {  
> > &nbsp;&nbsp;&nbsp;&nbsp;var isEnabled: Bool // good  
> > &nbsp;&nbsp;}
> > 
> > rather than
> > 
> > &nbsp;&nbsp;class Foo {  
> > &nbsp;&nbsp;&nbsp;&nbsp;var enabled: Bool // not Swifty  
> > &nbsp;&nbsp;}
> > 
> > When the property is @objc, e.g.,
> > 
> > &nbsp;&nbsp;class Foo : NSObject {  
> > &nbsp;&nbsp;&nbsp;&nbsp;@objc var isEnabled: Bool  
> > &nbsp;&nbsp;}
> > 
> > The resulting Objective-C property doesn’t follow the Cocoa guidelines for Objective-C \<[https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple\_ref/doc/uid/20001284-BAJGIIJE&gt;:](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-BAJGIIJE&gt;:)
> > 
> > &nbsp;&nbsp;@property (readwrite,nonatomic) BOOL isEnabled;
> > 
> > because those guidelines state that properties do not use the “is” prefix.
> > 
> > My proposal is to strip the “is” prefix from the Objective-C name, but leave it off the getter, e.g.,
> > 
> > &nbsp;&nbsp;@property (readwrite,nonatomic,getter=isEnabled) BOOL enabled;
> > 
> > The change would have no effect on the Swift name; it will only affect the Objective-C property name and setter name.
> > 
> > Thoughts?
> > 
> > &nbsp;&nbsp;- Doug
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-evolution mailing list  
> > swift-evolution@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![Rod\_Brown](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/rod_brown/32/425_2.png) [@Rod\_Brown](https://forums.swift.org/u/Rod_Brown)\
**Post date:** [February 23, 2016, 11:07pm UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538/6 "2016-02-23T23:07:45Z")

</div>

+1. I’ve been dealing with this quite a lot recently. Great solution.

> **···**
>
> > On 24 Feb 2016, at 8:00 AM, Douglas Gregor via swift-evolution \<swift-evolution@swift.org\> wrote:
> > 
> > Hi all,
> > 
> > The Swift API guidelines state that Boolean properties should reflect assertions about the receiver, so in Swift one would expect:
> > 
> > &nbsp;&nbsp;class Foo {  
> > &nbsp;&nbsp;&nbsp;&nbsp;var isEnabled: Bool // good  
> > &nbsp;&nbsp;}
> > 
> > rather than
> > 
> > &nbsp;&nbsp;class Foo {  
> > &nbsp;&nbsp;&nbsp;&nbsp;var enabled: Bool // not Swifty  
> > &nbsp;&nbsp;}
> > 
> > When the property is @objc, e.g.,
> > 
> > &nbsp;&nbsp;class Foo : NSObject {  
> > &nbsp;&nbsp;&nbsp;&nbsp;@objc var isEnabled: Bool  
> > &nbsp;&nbsp;}
> > 
> > The resulting Objective-C property doesn’t follow the Cocoa guidelines for Objective-C \<[https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple\_ref/doc/uid/20001284-BAJGIIJE&gt;:](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-BAJGIIJE&gt;:)
> > 
> > &nbsp;&nbsp;@property (readwrite,nonatomic) BOOL isEnabled;
> > 
> > because those guidelines state that properties do not use the “is” prefix.
> > 
> > My proposal is to strip the “is” prefix from the Objective-C name, but leave it off the getter, e.g.,
> > 
> > &nbsp;&nbsp;@property (readwrite,nonatomic,getter=isEnabled) BOOL enabled;
> > 
> > The change would have no effect on the Swift name; it will only affect the Objective-C property name and setter name.
> > 
> > Thoughts?
> > 
> > &nbsp;&nbsp;- Doug
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-evolution mailing list  
> > swift-evolution@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![Douglas\_Gregor](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/douglas_gregor/32/1362_2.png) [@Douglas\_Gregor](https://forums.swift.org/u/Douglas_Gregor)\
**Post date:** [February 24, 2016, 4:31pm UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538/7 "2016-02-24T16:31:31Z")

</div>

> Seems like an easy win, so I’m leaning towards a +1.
> 
> OTOH, are there any other cases where Swift -\> ObjC automatically changes names of things to optimize for ObjC? If we don’t do more of that (the '"Add needless words" to Objective-C method names’ thread, or other quick wins like this one), it would be weird to make just this one exception, a single special case. I fear this would be more surprising than not changing anything at all.

We do a bunch of this already. We join the first argument label to the base name to form the first selector piece, inserting “with” if there’s no preposition in between already, and for throwing methods we either add “error:” in the appropriate place or append “AndReturnError” to the first selector piece if there are no other parameters.

&nbsp;&nbsp;- Doug

> **···**
>
> > On Feb 24, 2016, at 12:36 AM, Radosław Pietruszewski \<radexpl@gmail.com\> wrote:
> 
> > — Radek
> > 
> > > On 23 Feb 2016, at 22:00, Douglas Gregor via swift-evolution \<swift-evolution@swift.org \<mailto:swift-evolution@swift.org\>\> wrote:
> > > 
> > > Hi all,
> > > 
> > > The Swift API guidelines state that Boolean properties should reflect assertions about the receiver, so in Swift one would expect:
> > > 
> > > &nbsp;&nbsp;class Foo {  
> > > &nbsp;&nbsp;&nbsp;&nbsp;var isEnabled: Bool // good  
> > > &nbsp;&nbsp;}
> > > 
> > > rather than
> > > 
> > > &nbsp;&nbsp;class Foo {  
> > > &nbsp;&nbsp;&nbsp;&nbsp;var enabled: Bool // not Swifty  
> > > &nbsp;&nbsp;}
> > > 
> > > When the property is @objc, e.g.,
> > > 
> > > &nbsp;&nbsp;class Foo : NSObject {  
> > > &nbsp;&nbsp;&nbsp;&nbsp;@objc var isEnabled: Bool  
> > > &nbsp;&nbsp;}
> > > 
> > > The resulting Objective-C property doesn’t follow the Cocoa guidelines for Objective-C \<[Naming Properties and Data Types](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-BAJGIIJE&gt;:)
> > > 
> > > &nbsp;&nbsp;@property (readwrite,nonatomic) BOOL isEnabled;
> > > 
> > > because those guidelines state that properties do not use the “is” prefix.
> > > 
> > > My proposal is to strip the “is” prefix from the Objective-C name, but leave it off the getter, e.g.,
> > > 
> > > &nbsp;&nbsp;@property (readwrite,nonatomic,getter=isEnabled) BOOL enabled;
> > > 
> > > The change would have no effect on the Swift name; it will only affect the Objective-C property name and setter name.
> > > 
> > > Thoughts?
> > > 
> > > &nbsp;&nbsp;- Doug
> > > 
> > > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > > swift-evolution mailing list  
> > > swift-evolution@swift.org \<mailto:swift-evolution@swift.org\>  
> > > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![anjerodesu](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@anjerodesu](https://forums.swift.org/u/anjerodesu)\
**Post date:** [February 24, 2016, 8:58am UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538/8 "2016-02-24T08:58:49Z")

</div>

Initialising a getter for a Boolean property is the default behaviour so a  
+1 vote from me.

- Angelo

> **···**
>
> On Wed, 24 Feb 2016 at 4:43 PM Radosław Pietruszewski \< swift-evolution@swift.org\> wrote:
> 
> > Seems like an easy win, so I’m leaning towards a +1.
> > 
> > OTOH, are there any other cases where Swift -\> ObjC automatically changes  
> > names of things to optimize for ObjC? If we don’t do more of that (the '"Add  
> > needless words" to Objective-C method names’ thread, or other quick wins  
> > like this one), it would be weird to make just this one exception, a single  
> > special case. I fear this would be more surprising than not changing  
> > anything at all.
> > 
> > — Radek
> > 
> > On 23 Feb 2016, at 22:00, Douglas Gregor via swift-evolution \< \> swift-evolution@swift.org\> wrote:
> > 
> > Hi all,
> > 
> > The Swift API guidelines state that Boolean properties should reflect  
> > assertions about the receiver, so in Swift one would expect:
> > 
> > class Foo {  
> > &nbsp;&nbsp;var isEnabled: Bool // good  
> > }
> > 
> > rather than
> > 
> > class Foo {  
> > &nbsp;&nbsp;var enabled: Bool // not Swifty  
> > }
> > 
> > When the property is @objc, e.g.,
> > 
> > class Foo : NSObject {  
> > &nbsp;&nbsp;@objc var isEnabled: Bool  
> > }
> > 
> > The resulting Objective-C property doesn’t follow the Cocoa guidelines  
> > for Objective-C  
> > \<[Naming Properties and Data Types](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-BAJGIIJE&gt);  
> > :
> > 
> > @property (readwrite,nonatomic) BOOL isEnabled;
> > 
> > because those guidelines state that properties do not use the “is” prefix.
> > 
> > My proposal is to strip the “is” prefix from the Objective-C name, but  
> > leave it off the getter, e.g.,
> > 
> > @property (readwrite,nonatomic,getter=isEnabled) BOOL enabled;
> > 
> > The change would have no effect on the Swift name; it will only affect the  
> > Objective-C property name and setter name.
> > 
> > Thoughts?
> > 
> > - Doug
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-evolution mailing list  
> > swift-evolution@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-evolution mailing list  
> > swift-evolution@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![Radek\_Pietruszewski](https://avatars.discourse-cdn.com/v4/letter/r/74df32/32.png) [@Radek\_Pietruszewski](https://forums.swift.org/u/Radek_Pietruszewski)\
**Post date:** [February 24, 2016, 4:45pm UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538/9 "2016-02-24T16:45:00Z")

</div>

Ah, didn’t realize this.

+1 then.

— Radek

> **···**
>
> > On 24 Feb 2016, at 17:31, Douglas Gregor \<dgregor@apple.com\> wrote:
> > 
> > > On Feb 24, 2016, at 12:36 AM, Radosław Pietruszewski \<radexpl@gmail.com \<mailto:radexpl@gmail.com\>\> wrote:
> > > 
> > > Seems like an easy win, so I’m leaning towards a +1.
> > > 
> > > OTOH, are there any other cases where Swift -\> ObjC automatically changes names of things to optimize for ObjC? If we don’t do more of that (the '"Add needless words" to Objective-C method names’ thread, or other quick wins like this one), it would be weird to make just this one exception, a single special case. I fear this would be more surprising than not changing anything at all.
> > 
> > We do a bunch of this already. We join the first argument label to the base name to form the first selector piece, inserting “with” if there’s no preposition in between already, and for throwing methods we either add “error:” in the appropriate place or append “AndReturnError” to the first selector piece if there are no other parameters.
> > 
> > &nbsp;&nbsp;- Doug
> > 
> > > — Radek
> > > 
> > > > On 23 Feb 2016, at 22:00, Douglas Gregor via swift-evolution \<swift-evolution@swift.org \<mailto:swift-evolution@swift.org\>\> wrote:
> > > > 
> > > > Hi all,
> > > > 
> > > > The Swift API guidelines state that Boolean properties should reflect assertions about the receiver, so in Swift one would expect:
> > > > 
> > > > &nbsp;&nbsp;class Foo {  
> > > > &nbsp;&nbsp;&nbsp;&nbsp;var isEnabled: Bool // good  
> > > > &nbsp;&nbsp;}
> > > > 
> > > > rather than
> > > > 
> > > > &nbsp;&nbsp;class Foo {  
> > > > &nbsp;&nbsp;&nbsp;&nbsp;var enabled: Bool // not Swifty  
> > > > &nbsp;&nbsp;}
> > > > 
> > > > When the property is @objc, e.g.,
> > > > 
> > > > &nbsp;&nbsp;class Foo : NSObject {  
> > > > &nbsp;&nbsp;&nbsp;&nbsp;@objc var isEnabled: Bool  
> > > > &nbsp;&nbsp;}
> > > > 
> > > > The resulting Objective-C property doesn’t follow the Cocoa guidelines for Objective-C \<[Naming Properties and Data Types](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-BAJGIIJE&gt;:)
> > > > 
> > > > &nbsp;&nbsp;@property (readwrite,nonatomic) BOOL isEnabled;
> > > > 
> > > > because those guidelines state that properties do not use the “is” prefix.
> > > > 
> > > > My proposal is to strip the “is” prefix from the Objective-C name, but leave it off the getter, e.g.,
> > > > 
> > > > &nbsp;&nbsp;@property (readwrite,nonatomic,getter=isEnabled) BOOL enabled;
> > > > 
> > > > The change would have no effect on the Swift name; it will only affect the Objective-C property name and setter name.
> > > > 
> > > > Thoughts?
> > > > 
> > > > &nbsp;&nbsp;- Doug
> > > > 
> > > > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > > > swift-evolution mailing list  
> > > > swift-evolution@swift.org \<mailto:swift-evolution@swift.org\>  
> > > > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![griotspeak](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/griotspeak/32/1966_2.png) [@griotspeak](https://forums.swift.org/u/griotspeak)\
**Post date:** [February 25, 2016, 2:05am UTC](https://forums.swift.org/t/idea-make-boolean-objc-properties-reflect-better-into-objective-c/1538/10 "2016-02-25T02:05:10Z")

</div>

+1

> **···**
>
> On Wed, Feb 24, 2016 at 11:45 AM, Radosław Pietruszewski \< swift-evolution@swift.org\> wrote:
> 
> > Ah, didn’t realize this.
> > 
> > +1 then.
> > 
> > — Radek
> > 
> > On 24 Feb 2016, at 17:31, Douglas Gregor \<dgregor@apple.com\> wrote:
> > 
> > On Feb 24, 2016, at 12:36 AM, Radosław Pietruszewski \<radexpl@gmail.com\> \> wrote:
> > 
> > Seems like an easy win, so I’m leaning towards a +1.
> > 
> > OTOH, are there any other cases where Swift -\> ObjC automatically changes  
> > names of things to optimize for ObjC? If we don’t do more of that (the '"Add  
> > needless words" to Objective-C method names’ thread, or other quick wins  
> > like this one), it would be weird to make just this one exception, a single  
> > special case. I fear this would be more surprising than not changing  
> > anything at all.
> > 
> > We do a bunch of this already. We join the first argument label to the  
> > base name to form the first selector piece, inserting “with” if there’s no  
> > preposition in between already, and for throwing methods we either add  
> > “error:” in the appropriate place or append “AndReturnError” to the first  
> > selector piece if there are no other parameters.
> > 
> > - Doug
> > 
> > — Radek
> > 
> > On 23 Feb 2016, at 22:00, Douglas Gregor via swift-evolution \< \> swift-evolution@swift.org\> wrote:
> > 
> > Hi all,
> > 
> > The Swift API guidelines state that Boolean properties should reflect  
> > assertions about the receiver, so in Swift one would expect:
> > 
> > class Foo {  
> > &nbsp;&nbsp;var isEnabled: Bool // good  
> > }
> > 
> > rather than
> > 
> > class Foo {  
> > &nbsp;&nbsp;var enabled: Bool // not Swifty  
> > }
> > 
> > When the property is @objc, e.g.,
> > 
> > class Foo : NSObject {  
> > &nbsp;&nbsp;@objc var isEnabled: Bool  
> > }
> > 
> > The resulting Objective-C property doesn’t follow the Cocoa guidelines  
> > for Objective-C  
> > \<[https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple\_ref/doc/uid/20001284-BAJGIIJE&gt](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-BAJGIIJE&gt);  
> > :
> > 
> > @property (readwrite,nonatomic) BOOL isEnabled;
> > 
> > because those guidelines state that properties do not use the “is” prefix.
> > 
> > My proposal is to strip the “is” prefix from the Objective-C name, but  
> > leave it off the getter, e.g.,
> > 
> > @property (readwrite,nonatomic,getter=isEnabled) BOOL enabled;
> > 
> > The change would have no effect on the Swift name; it will only affect the  
> > Objective-C property name and setter name.
> > 
> > Thoughts?
> > 
> > - Doug
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-evolution mailing list  
> > swift-evolution@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-evolution mailing list  
> > swift-evolution@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)
