I just looked through the Key-Value Coding Programming Guide, and I’m wondering 
what the prototypes are of the name-customized methods for your properties in 
Swift.  Since the KVC protocol is informal, getting the names and/or types 
wrong doesn’t mean an error, but that your implementation is ignored and 
default handling is done.

For instance:

//=====
   func validateBody(ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>) 
throws {
       guard let newBody = ioValue.memory as? NSString else {
           throw NSCocoaError.KeyValueValidationError
       }

       let errors = self.dynamicType.problemsValidatingBody(newBody as String)
       if !errors.isEmpty {
           throw errors.first!
       }
       // Else: do nothing
   }
//=====

is this the correct signature to KVC-validate a property named “body” in Swift?

(Incidentally, is that a good implementation?)

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

_______________________________________________

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