tauri-apps / wry

Cross-platform WebView library in Rust for Tauri.
Apache License 2.0
3.26k stars 237 forks source link

Proposal: Use `objc2` and its framework crates #1239

Open madsmtm opened 2 weeks ago

madsmtm commented 2 weeks ago

objc2 is the successor to objc, which includes a bunch of improvements, especially wrt. memory management. Additionally, it provides the objc2-foundation, objc2-app-kit and objc2-web-kit crates, which would be very useful for wry to decrease the amount of error-prone manual binding code. Finally, the declare_class! macro would be useful for creating wry's delegate classes.

I begun on the transition a little bit in this branch, but realized it's gonna be a lot of work, so wanted to get some feedback first (or ideally: get someone else to do the work ;) ).

We should also migrate to it in muda, tray-icon, window-vibrancy, tao, tauri, tauri-runtime-wry and so on, but doing that in these crates is substantially less work (updating tao to a newer Winit should fix it automatically, and the rest are fairly small), and can be done in parallel.

amrbashir commented 2 weeks ago

Thanks for reaching out, this has been a task on our radar for a while now but we didn't have the time to go through it yet.

iirc @pewsheen have started to migrate wry to objc2 in refactor/migrate-to-objc2 branch but not sure what's the progress on that (so pinging him for status update).

As for tao:

updating tao to a newer Winit should fix it automatically, and the rest are fairly small

Not sure what you mean by that, do you mean manually copying from winit repo or did the work on allowing a external backend has landed?

As for other crates, I agree they are substantially less work and I could help migrating them once wry has migrated.

madsmtm commented 2 weeks ago

Not sure what you mean by that, do you mean manually copying from winit repo or did the work on allowing a external backend has landed?

I meant when / if you manually copied commits from the Winit repo, not sure how you usually do Winit upgrades in tao.

Allowing external backends isn't yet possible, if you want to wait for that then that's fine by me ;).

amrbashir commented 2 weeks ago

Not sure what you mean by that, do you mean manually copying from winit repo or did the work on allowing a external backend has landed?

I meant when / if you manually copied commits from the Winit repo, not sure how you usually do Winit upgrades in tao.

yeah I usually just manually copy the code and attribute the original PR and its author. Anyways, it is probably very hard to copy the current macOS backend from winit to tao as the two have diverged a lot and probably will take the same effort (if not more) as wry to migrate.

Allowing external backends isn't yet possible, if you want to wait for that then that's fine by me ;).

That would be the optimal solution ofc, but if I ever get some time, I may think of an interim solution like maybe using git patches to patch our gtk backend on top of winit.