> On Jun 4, 2016, at 12:44 PM, Quincey Morris
> <[email protected]> wrote:
>
> On Jun 4, 2016, at 07:10 , Daryle Walker <[email protected]
> <mailto:[email protected]>> wrote:
>>
>> 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.
>
> Well, there’s the same danger in Obj-C code, too. However, the clang compiler
> will actually suggest property-specific KVC method signatures via
> autocomplete.
And that the Obj-C versions of the prototypes are in the guide, which hasn’t
been updated for Swift.
>> func validateBody(ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>)
>> throws {
>>
>> is this the correct signature to KVC-validate a property named “body” in
>> Swift?
>
> I think so. Since it’s unlikely you arrived at this by guesswork, you likely
> got it via autocomplete for ‘validateValueForKey’ and modifying the result.
> This seems like the correct thing to do. (You could also submit a bug asking
> for the clang autocomplete behavior.)
Actually, that’s what happened, but only as I was typing in my first guess. It
was the same except I mapped, based on the Swift w/ Cocoa & Obj-C guide, the
“id *” in the KVC guide to a “UnsafeMutablePointer<AnyObject>”. Anyone know
why it’s different?
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
_______________________________________________
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]