Re: Using protocol extension to dismiss keyboard on outside tap
Re: Using protocol extension to dismiss keyboard on outside tap
- Subject: Re: Using protocol extension to dismiss keyboard on outside tap
- From: Alex Zavatone <email@hidden>
- Date: Mon, 18 Apr 2016 17:06:01 -0400
Did your view controller conform to the protocol that you established for it? You know, the little thing that goes after your @interface? <MyAwesomeProtocol>
??
On Apr 18, 2016, at 4:48 AM, Devarshi Kulshreshtha wrote:
> On doing that it started showing me this error:
>
> Type `MyViewController` does not conform to protocol
> `DismissKeyboardOnOutsideTap`.
>
> On code suggestion it showed:
>
> Fix-it: Candidate is not `objc` but protocol requires it
>
> On Mon, Apr 18, 2016 at 1:59 PM, Quincey Morris <
> email@hidden> wrote:
>
>> On Apr 18, 2016, at 01:07 , Devarshi Kulshreshtha <
>> email@hidden> wrote:
>>
>>
>> extension DismissKeyboardOnOutsideTap {
>> func configureToDismissKeyboard() {
>> …
>> }
>>
>> func hideKeyboard() {
>> …
>> }
>>
>> }
>>
>>
>> I think the problem is that your methods are Swift functions, and so have
>> mangled names. It should be enough to declare protocol as an Obj-C protocol:
>>
>> @objc protocol DismissKeyboardOnOutsideTap {
>> …
>> }
>>
>>
>> Since all the classes involved are Obj-C classes, I don’t think it has to
>> be any more complicated than this.
>>
>>
>
>
> --
> Thanks,
>
> Devarshi
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden