On May 12, 2015, at 15:38 , Quincey Morris 
<quinceymor...@rivergatesoftware.com> wrote:
> 
> dynamic var message: String
> dynamic var messageIsEmpty: Bool {return String == “”}
> static var keyPathsForValuesAffectingMessageIsEmpty: NSSet {return NSSet 
> (object: "messageIsEmpty”)}

FWIW, a Swift-ier way to do this might be something like:

        dynamic var message: String = "" {
                didSet {messageIsEmpty = message == ""}
        }
        private(set) dynamic var messageIsEmpty: Bool = true

This is at the cost of actually storing the derived property value, though 
that’s not likely to be a problem in window controller.

(Again, not tested.)



_______________________________________________

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