Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Objective-C interop code #6474

Merged
merged 2 commits into from
Jan 1, 2025

Conversation

frenzibyte
Copy link
Member

  • Moves NSString/NSImage conversion methods away from Cocoa class
  • Defines NSString and uses stringWithCharacters:length: rather than alloc & initWithCharacters:length:
    • General rule of thumb in Objective-C to never use alloc and init if there's a "convenient constructor" available.
  • Uses LibraryImport instead of DllImport (optional but why not)
  • Moves code that can be shared with iOS to a different namespace and renames Cocoa to Interop.

I've also explored the path of using native SDKs offered by .NET but it was not a simple change and a lot needs to be reconsidered, so I'm not looking into that any further at the moment.

@smoogipoo
Copy link
Contributor

To confirm, have you tested this on a release mode build of o!f on iOS (i.e. LLVM full opts)?

@frenzibyte
Copy link
Member Author

Hmm, iOS did not come to my mind while working on this, although I did touch it in the next PR...I'll test on release mode and confirm.

@smoogipoo smoogipoo merged commit 56d212b into ppy:master Jan 1, 2025
12 of 14 checks passed
@frenzibyte frenzibyte deleted the macos-vimage-prereq branch January 1, 2025 16:51
@frenzibyte
Copy link
Member Author

I suppose you've tested this already, but I just got around doing that and tested this alongside the follow-up PR as well (#6475). All working correctly on a release build of iOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants