Skip to content

Clean up macOS class declaration#2458

Merged
madsmtm merged 6 commits intomasterfrom
objc2-macos-delegates
Sep 2, 2022
Merged

Clean up macOS class declaration#2458
madsmtm merged 6 commits intomasterfrom
objc2-macos-delegates

Conversation

@madsmtm
Copy link
Member

@madsmtm madsmtm commented Sep 2, 2022

Part of #2427.

Use the new objc2::declare_class! macro to vastly improve our code that declares custom classes. Notable improvements:

  • The selector and the method implementation are right next to each other (instead of being split out over the file).
  • You can use self very naturally
  • You don't have to worry about ABI details like the extra Sel parameter
  • You can now take and return bool directly in delegate methods

Further improvements (e.g. to ivar handling) will come later. Will also fix the formatting of view.rs and window_delegate.rs in a subsequent PR, to keep the diff smaller.

  • Tested on all platforms changed

@madsmtm madsmtm added DS - appkit Affects the AppKit/macOS backend S - maintenance Repaying technical debt labels Sep 2, 2022
@madsmtm madsmtm added this to the Version 0.28 milestone Sep 2, 2022
@madsmtm madsmtm force-pushed the objc2-macos-delegates branch from a723a64 to c620ea2 Compare September 2, 2022 15:59
@madsmtm madsmtm merged commit d67c928 into master Sep 2, 2022
@madsmtm madsmtm deleted the objc2-macos-delegates branch September 2, 2022 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - appkit Affects the AppKit/macOS backend S - maintenance Repaying technical debt

Development

Successfully merging this pull request may close these issues.

1 participant