[swift-users] Possible swift 3 method rewrite issue with NSRequestConcreteImplementation ?

John Spurlock john.spurlock at gmail.com
Tue Jul 19 10:20:10 CDT 2016


Ok, filed a new bug for the encodeInt:forKey issue:  rdar://problem/27425997

Ensured it reproduces in xcode beta 3, swift version 3.0
(swiftlang-800.0.34.6 clang-800.0.33)

Is there anything I can do in the meantime as a swift-only workaround to
fix my custom NSCoder?

Thanks,
- john

On Mon, Jul 18, 2016 at 10:52 PM, Tony Parker <anthony.parker at apple.com>
wrote:

> We renamed some of these methods for Swift 3 in an attempt to remove some
> of the confusion surrounding which of these did what - they were really
> named for C types and not Swift ones.
>
> encodeInt:forKey: and decodeInt:forKey: are the two missing ones, since
> they were easily confused with the Swift Int type. I think we’ll have to
> figure out a different approach here. John, please file a bug at
> bugreport.apple.com and let me know the radar number, and we’ll look into
> it.
>
> Thanks,
> - Tony
>
> > On Jul 18, 2016, at 6:33 PM, Brent Royal-Gordon <brent at architechies.com>
> wrote:
> >
> >> Hi Tony - when I add that attribute, I get an error at compile-time:
> >> Objective-C method has a different selector from the method it
> overrides ('encodeInt:forKey:' vs. 'encodeInteger:forKey:')
> >>
> >> If I update to encodeInteger:forKey as the fix describes, it compiles,
> but I'm getting the same original problem at runtime.  i.e.
> "encodeInt:forKey: only defined for abstract class"
> >>
> >> Any other ideas?  See the same thing over there?  You should be able to
> paste that into a new swift 3 test.
> >
> > If you look at the NSCoder documentation, you'll see 25 methods in the
> Swift version of the "Encoding General Data" section, and 27
> (non-deprecated) in the Objective-C version. `-encodeInt:forKey:` has no
> Swift equivalent. I'm not sure what the other missing method is.
> >
> > I think this is probably a bug or design oversight, and I'd recommend
> you file a radar against Foundation. If this is a primitive method for
> NSCoding, it needs to be accessible from Swift.
> >
> > --
> > Brent Royal-Gordon
> > Architechies
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160719/e49f0953/attachment.html>


More information about the swift-users mailing list