native-dialog-rs
native-dialog-rs copied to clipboard
macOS: Use `objc2` crates
These replace the objc family of crates, and provide a bunch of improvements on top, especially wrt. correct memory management.
Improvements that we use in native-dialog:
- We no longer need to call
msg_send!, (almost) all methods have automatically generated bindings inobjc2-foundation. - AppKit bindings are provided in
objc2-app-kit, so we no longer need to defineNSEdgeInsets,NSOpenPaneland such manually. boolis handled automatically, no need for theobjc_boolconversion routine.declare_class!is used to create theDropdownActionhelper class.
For this initial transition, I decided to keep the I... extension traits around, to make the diff in src/dialog_impl/mac/file.rs minimal.
In the future, the MainThreadMarker type could be used to easily assert that things are happening on the main thread, to prevent issues such as https://github.com/native-dialog-rs/native-dialog-rs/issues/36.