4 ms·
I assume those questions are rhetorical, but let me try to answer them in a very terse form just so you have some terms to search the docs for. Assuming you wan
by newaccount74 4y ago
I assume those questions are rhetorical, but let me try to answer them in a very terse form just so you have some terms to search the docs for. Assuming you want to use AppKit.
> What is the equivalent of the event loop under macos?
NSRunLoop / CFRunLoop. You rarely need to interact with it directly. Typically only the main run loop on the main thread is important, if you want to do something on a different thread you typically use dispatch queues (GCD=grand central dispatch) instead of run loops.
> Do events bubble up through the hierarchy?
Yes, most events go up the responder chain, which is typically view -> superviews -> window -> app. You typically respond to events by implementing methods defined in a protocol (like "keyDown" or "insertTab") or by implementing delegate methods ("windowWillClose"). Sometimes you also have to listen for notifications from NotificationCenter.
> What is the right way to persist user configuration?
NSUserDefaults for everything that can be serialised into a number/string/dictionary easily, and the application support directory for anything you want to store in files.