News for hackers. Stuff that matters.
Re:Swift Asserts by jcizzle on Friday March 04, 2016 @11:11AM (#11224668)
Interesting. Just tried another approach, and you can get the behavior by overriding reportException: in a custom NSApplication subclass.

edit: Also I'm not suggesting to just naively exit(1). edit2: Strangely, exception generating code in [[NSOperationQueue mainQueue] addOperationWithBlock:] does actually hit the NSUncaughtExceptionHandler, which was surprising to me.

Re:Swift Asserts by mikeash on Friday March 04, 2016 @11:18AM (#11224730)
The mainQueue thing is because the catch-all exception handler is in the event loop, not the runloop. So if you throw during event handling (mouse down, key down) you'll hit it, but if it's something else (GCD, timers) you won't. It's extremely weird.

Good call about reportException:. Although I personally prefer to just avoid NSAssert. The good old C assert() gets the job done well for me.

Re:Swift Asserts by jcizzle on Friday March 04, 2016 @11:20AM (#11224747)
Good to note, I must have logically mapped addOperationWithBlock: to a typical NSResponder event in my head, but what you're saying makes more sense.