Using protocol extension to dismiss keyboard on outside tap

2016-04-18 Thread Devarshi Kulshreshtha
In my project I have few view controllers which are subclasses of UITableViewController, UIViewController, on each I want to implement this behavior: > When user taps outside of a text field it should dismiss the keyboard which was visible when user tapped inside it. I can easily implement it by

Re: Using protocol extension to dismiss keyboard on outside tap

2016-04-18 Thread Quincey Morris
On Apr 18, 2016, at 01:07 , Devarshi Kulshreshtha wrote: > >extension DismissKeyboardOnOutsideTap { >func configureToDismissKeyboard() { >… >} > >func hideKeyboard() { >… >} > >} I think the problem is that your methods are Swift

Re: Using protocol extension to dismiss keyboard on outside tap

2016-04-18 Thread Devarshi Kulshreshtha
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 < quinceymor...@rivergatesof

Re: Getting a double-click on a text label

2016-04-18 Thread Graham Cox
> On 18 Apr 2016, at 11:46 AM, Ryan Dignard > wrote: > > Would NSClickGestureRecognizer work? I've done this on iOS with the > equivalent UITapGestureRecognizer. > That worked a treat, thanks! Only available from 10.10, but I can live with that, older OS will just not get the shortcut an

Re: Using protocol extension to dismiss keyboard on outside tap

2016-04-18 Thread Alex Zavatone
What if you were able to pass in a view that is the containing view that you want to receive the dismiss tap, then add an action to it to call the expected dismiss method? Hmmm, that won't work if there are other tappable items on the screen though. I just had this issue too last week, so I'l

Re: Proper way to set up constants when building an iOS framework

2016-04-18 Thread Alex Zavatone
On Apr 15, 2016, at 4:58 PM, Jens Alfke wrote: > >> On Apr 15, 2016, at 1:34 PM, Alex Zavatone wrote: >> >> One thing though. I did do a #import of "Constants.h" into my framework's >> header file and that's not filling the role of what a .pch would fill in a >> standalone app, even though

Re: Using protocol extension to dismiss keyboard on outside tap

2016-04-18 Thread Alex Zavatone
Did your view controller conform to the protocol that you established for it? You know, the little thing that goes after your @interface? ?? On Apr 18, 2016, at 4:48 AM, Devarshi Kulshreshtha wrote: > On doing that it started showing me this error: > > Type `MyViewController` does not conf

Re: Proper way to set up constants when building an iOS framework

2016-04-18 Thread Jens Alfke
> On Apr 18, 2016, at 2:03 PM, Alex Zavatone wrote: > >> Is Constants.h in the framework’s Headers directory, next to the main >> framework header file? > > Where in the project? In target framework's Build Phases Headers section? Is this in a different project that uses your framework? If s

BOOL parameter passed as nil object

2016-04-18 Thread Carl Hoefs
Suppose I have an object with a declared method signature: -(void)myMethod:(BOOL)a_bool; Q1: If I invoke it like this: [self performSelector:@selector(myMethod:) withObject:nil]; // nil obj Will argument a_bool end up with a 0 value assigned to it? Q2: But if I invoke it like this: [self p

Re: BOOL parameter passed as nil object

2016-04-18 Thread Ryan Dignard
To answer your second question consider BOOL b = (BOOL)someObj; if someObj happens to equal something like 0x12345600 the value of b will be NO because casting from a pointer to a char will return the least significant byte. For your first question I don't know exactly but it doesn't look safe;

Re: BOOL parameter passed as nil object

2016-04-18 Thread Ken Thomases
On Apr 18, 2016, at 8:56 PM, Carl Hoefs wrote: > > Suppose I have an object with a declared method signature: > -(void)myMethod:(BOOL)a_bool; > > Q1: If I invoke it like this: > [self performSelector:@selector(myMethod:) withObject:nil]; // nil obj > Will argument a_bool end up with a 0 value

Re: BOOL parameter passed as nil object

2016-04-18 Thread M Pulis
What does the compiler say? Not tried this, but as BOOL is neither a pointer nor subclass of NSObject, I would not expect reliable results, but a type mismatch. Of course, I could be wrong, YMMV. Gary On Apr 18, 2016, at 6:56 PM, Carl Hoefs wrote: Suppose I have an object with a declare

Re: BOOL parameter passed as nil object

2016-04-18 Thread Sean McBride
On Mon, 18 Apr 2016 18:56:43 -0700, Carl Hoefs said: >Suppose I have an object with a declared method signature: > -(void)myMethod:(BOOL)a_bool; > >Q1: If I invoke it like this: > [self performSelector:@selector(myMethod:) withObject:nil]; // nil obj Stop right there, you are violating the doc

Re: Using protocol extension to dismiss keyboard on outside tap

2016-04-18 Thread Devarshi Kulshreshtha
Thanks, I ended doing exactly what you suggested. On Mon, Apr 18, 2016 at 10:41 PM, Quincey Morris < quinceymor...@rivergatesoftware.com> wrote: > On Apr 18, 2016, at 08:48 , Alex Kac wrote: > > > Protocol extensions are Swift only - not ObjC compatible I believe. > > > You’re right, and I don’t