ryanmcgrath/cacao

Async, Background, and Local Dispatchers support

JoshuaBrest opened this issue · 4 comments

I think we should add the following features to make development easier:

  • Async
    • Maybe you need to call async functions
    • Could be done by calling a background task to modify the view later instead of in the did_load
  • Background
    • Maybe a background task might be useful for like setInterval
  • Local Dispatcher
    • So that instead of adding complicated logic in App, you can do it in the local view impl

See some of the previous discussion on this in madsmtm/objc2#279.

In short: async Objective-C is difficult, and especially difficult to make efficient!

I'm neither for nor against this conceptually, but I think I'd ultimately defer to anything @madsmtm does upstream in objc2 - which cacao needs to ultimately rebase on and finally merge anyway.

We can keep this open as a general tracking issue and I'll label it accordingly, but don't expect much for some time.

For the local dispatcher, i think it would be possible if we added lifetimes or just used unsafe. It should be fine if we unregister the fn,

@ryanmcgrath As I was discovering about objc it turns out the handlers are called in a different whole context where memory in the main thread is not even accessible from a rust fn.