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

My improvements #173

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft

Conversation

MaddTheSane
Copy link

@MaddTheSane MaddTheSane commented Jan 30, 2025

This draft is where I want to push some of the changes that I've implemented in my own fork. Most of these are to increase interoperability with Swift. The first commit was migrating from informal protocols to formal protocols with optionals. This is very much a project that I do want feedback on.

Other planned additions include:

  • Migrating to use NS_ENUM/NS_OPTIONS where appropriate.
  • Use of NS_TYPED_ENUM/NS_TYPED_EXTENSIBLE_ENUM where appropriate
  • Add NSError methods to better work with Swift (My fork wraps the exception-throwing methods, catches the exception, then converts it into an equivalent NSError. A better way would be to migrate as much of the code to use NSErrors only. Relevant code: Link ).
  • Rename some enums to better work with Swift.
  • Use CommonCrypto where possible.
  • Add deprecation markings to symbols (some of this has already been done).
  • Use Objective-C 2 @propertys, for-in loops, and @autoreleasepool (this will depend on what other architectures actually support).

A lot of these can be accomplished with using macros on non-Apple platforms (See here for an example).

What I will not (or try not to) do, mainly because the non-Apple runtimes and/or compilers don't support them:

  • Migrate project to ARC (To my knowledge, no other target other than Apple's platforms support it).
  • Add Swift wrappers for specific functions (This would require a lot of work on editing the makefile).

What needs to be discussed:

  • Add generics metadata (Would help with Swift interoperability, but would require either a lot of macros or dropping non-Apple platforms).
  • Nullability metadata (would add more analysis to existing code, as well as better Swift interoperability, but might require more macros for non-Apple platforms).

… XADArchiveKeys as typed extensible enums.

Also wrap local includes in "#pragma clang diagnostic" to prevent warnings.
Also add NS_ENUM macro, and expand API_DEPRECATED_WITH_REPLACEMENT to point to the replacement.
Also fix some deprecation warnings.
Add XADEXPORT to public classes, and XADEXTERN to public functions.
Add missing XADStringEncodingName renames in XADPath.
Make XADAction an NS_ENUM.
…DErrorDomain better map to XADErrors.

Use our own custom macro to keep XADError the same size, as NS_ERROR_ENUM uses NSInteger.
Also rename the error values to make them look pretty under Swift.
@MaddTheSane MaddTheSane force-pushed the backToUpstream1 branch 2 times, most recently from 6bbfcb7 to ef6aa4d Compare February 7, 2025 02:54
@MaddTheSane MaddTheSane force-pushed the backToUpstream1 branch 6 times, most recently from a96c995 to c2c13a1 Compare February 7, 2025 03:17
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.

1 participant