Re: Swift 3 macOS read keyboard

2016-10-10 Thread Quincey Morris
On Oct 10, 2016, at 16:00 , Eric Dolecki wrote: > > Can I […] set accepts first responder true. Unfortunately, no. It’s a read-only property. > I didn't know I might need to use subclassing to capture key events. Perhaps it can be regarded as an old-school paradigm. It is

Re: Swift 3 macOS read keyboard

2016-10-10 Thread Eric Dolecki
Can I do number 2? Subclass NSVIEWCONTROLLER and do the key up and down and set accepts first responder true. If it's that simple, cool. I didn't know I might need to use subclassing to capture key events.  Sent from Outlook on my phone. On Mon, Oct 10, 2016 at 6:36 PM -0400, "Quincey

Re: Swift 3 macOS read keyboard

2016-10-10 Thread Quincey Morris
On Oct 10, 2016, at 15:07 , Graham Cox wrote: > > NSWindow, NSWindowController and NSView, NSViewController all inherit from > NSResponder, which provide standard methods for dealing with keyUp and > keyDown events. I agree with everything you said, but a bit of

Re: Swift 3 macOS read keyboard

2016-10-10 Thread Graham Cox
I don’t think this is the right way to do this. NSWindow, NSWindowController and NSView, NSViewController all inherit from NSResponder, which provide standard methods for dealing with keyUp and keyDown events. The normal approach to receive these events is to subclass one of these (least

Re: How to count Atoms

2016-10-10 Thread Greg Parker
> On Oct 7, 2016, at 9:06 PM, Gerriet M. Denkmann wrote: > > My preferred way to count (not deprecated and fast, but, as you said, > probably not available in Swift) is: > > #import > atomic_uint_fast64_t counter; > atomic_fetch_add_explicit( , 1,

State restoration Debugging

2016-10-10 Thread Alex Kac
I’m curious if anyone has some helpful hints when state restoration doesn’t work. I have the following situation: UIWindow subclass -UITabViewController subclass Each tab has: —UISplitViewController subclass —UINavigationController subclass -UIVC Master subclass -UIVC Detail

Re: Swift 3 macOS read keyboard

2016-10-10 Thread Eric E. Dolecki
I just discovered override func keyDown(with event: NSEvent) { } override func keyUp(with event: NSEvent) {} NSEvent.addLocalMonitorForEvents(matching: .keyUp) { (aEvent) -> NSEvent? in self.keyUp(with: aEvent) return aEvent }

Swift 3 macOS read keyboard

2016-10-10 Thread Eric E. Dolecki
I am delving into macOS development and I'd like to do something simple. Give the Application Window "focus" to receive keyboard events. Meaning no text fields. How exactly do I do this? I've been googling and have seen all kinds of things but none of them have worked out. What would be the most