[swift-users] Cannot implement NSURLSessionDownloadDelegate

Sebastian Hagedorn sebastian at iosphere.de
Thu Mar 31 04:31:01 CDT 2016


You’d have to add @objc(updateSearchResultsForSearchController:) to it.

If you’re having issues in other places of your code, you can easily get the ObjC selector form by looking into the online docs, e.g.:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISearchResultsUpdating_ClassRef/index.html

…and choose Objective-C as your preferred language in the top panel.

While this works well enough for required protocol methods, the bigger problem is with optional methods, as the compiler won’t complain if it doesn’t find a matching Swift method, it just won’t ever be called.


> On 31 Mar 2016, at 00:34, Charles Lane <clane_47 at bellsouth.net> wrote:
> 
> I have the same problem except it’s with the UISearchResultsUpdating protocol. I read Jordan’s reply with the workaround but I’m not familiar enough with OBJC to implement it. Could you possibly show me the correct form for the following:
> 
> func updateSearchResults(for searchController: UISearchController) {
>         
>     }
> 
> How do I format that using the ‘objc’ attribute to make it satisfy the protocol requirements? I know that Apple will fix this soon, but I’m curious…..
> 
> Thanks,
> Chuck Lane

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160331/38135ad6/attachment.html>


More information about the swift-users mailing list