Skip to content

Conversation

@madsmtm
Copy link
Contributor

@madsmtm madsmtm commented May 1, 2024

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 in objc2-foundation.
  • AppKit bindings are provided in objc2-app-kit, so we no longer need to define NSEdgeInsets, NSOpenPanel and such manually.
  • bool is handled automatically, no need for the objc_bool conversion routine.
  • declare_class! is used to create the DropdownAction helper 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 #36.

These replace the `objc` family of crates, and provide a bunch of
improvements on top.

Improvements that we use in `native-dialog`:
- We no longer need to call `msg_send!`, (almost) all methods have
  automatically generated bindings in `objc2-foundation`.
- AppKit bindings are provided in `objc2-app-kit`, so we no longer need
  to define `NSEdgeInsets`, `NSOpenPanel` and such manually.
- `bool` is handled automatically, no need for the `objc_bool`
  conversion routine.
- `declare_class!` is used to create the `DropdownAction` helper 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.
@balthild balthild merged commit 7fb61e6 into native-dialog-rs:master Apr 11, 2025
@madsmtm madsmtm deleted the objc2 branch April 11, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants