Skip to content

Clear the mechanical AppKit deprecation warnings - #580

Merged
hannesa2 merged 2 commits into
gitx:masterfrom
goneng:clear-appkit-deprecation-warnings
Aug 22, 2026
Merged

hannesa2 merged 2 commits into
gitx:masterfrom
goneng:clear-appkit-deprecation-warnings

Conversation

@goneng

@goneng goneng commented Aug 21, 2026 •

Copy link
Copy Markdown
Collaborator

Clear 17 deprecation warnings in GitX's own source by moving to the
API spellings the macOS SDK documents today, with no behaviour change.

  • Swap eight renamed AppKit constants for their current names; the SDK
    declares each old name as an exact alias of the new one
    (NSBackgroundStyleDark = NSBackgroundStyleEmphasized, and so on),
    so every site is value-identical
  • Drop the setOneShot: call on the search rewind panel, which the SDK
    documents as having no effect
  • Adopt NSMenuItemValidation on the three classes implementing
    validateMenuItem:, which is where AppKit moved the method in
    macOS 11
  • Hold the git version comparison in PBGitBinary in an
    NSComparisonResult rather than an int

These were picked out of a wider warning triage as the group that needs no judgement:
every changed line is a rename or a protocol declaration.
The remaining deprecations in GitX (WebKit, pasteboard types, keyed archiving,
NSConnection, FSEvents) all need real decisions and are left alone.
The WebKit ones in particular belong to PR #535,
and nothing here touches the files it changes.

Compatibility

The deployment target is unaffected.
Every constant here is a compile-time enum value or static const alias,
so nothing is resolved at runtime; compiling both spellings to assembly and diffing
gives identical output.
Building with -Werror=unguarded-availability at a minimum of macOS 10.9
flags none of them, including the NSMenuItemValidation conformance.

For older toolchains, the new spellings were compile-verified against
the MacOSX 12.1, 13.3, 14.4 and 15.4 SDKs, all of which accept the full set.
That is already below the floor the project sets for itself, since
MACOSX_DEPLOYMENT_TARGET = 13.0 rules out any SDK older than macOS 13
with or without this change.

Test plan

  • xcodebuild build -workspace GitX.xcworkspace -scheme GitX -destination "platform=macOS,arch=arm64"
    succeeds;
    GitX's own warning count drops from 85 to 67
  • xcodebuild test -workspace GitX.xcworkspace -scheme GitX -only-testing:GitXTests
    passes, 35 tests, unchanged from master
  • Each replacement was checked against the SDK headers to confirm the old constant is
    declared as an alias of the new one, and compiled against the MacOSX 12.1 through 15.4 SDKs
    to confirm the new name exists there too

@goneng
goneng marked this pull request as ready for review August 21, 2026 21:18
@goneng
goneng force-pushed the clear-appkit-deprecation-warnings branch from de1f2d7 to 27e8e2f Compare August 21, 2026 23:05
goneng added 2 commits August 22, 2026 03:31
Replace AppKit constants that Apple renamed with the spellings the
SDK documents today, so the build stops reporting them.

- Swap NSFileHandlingPanelOKButton, NSKeyDown, NSRightMouseDown,
  NSBorderlessWindowMask, NSCompositeCopy, NSRoundLineCapStyle,
  NSCenterTextAlignment and NSBackgroundStyleDark for their current
  names; the SDK declares each old name as an exact alias of the new
  one, so behaviour is unchanged
- Drop the setOneShot: call on the search rewind panel, which the SDK
  documents as having no effect
- Hold the git version comparison in an NSComparisonResult rather
  than an int
Declare the three classes that implement validateMenuItem: as
conforming to NSMenuItemValidation, which is where AppKit moved the
method in macOS 11.

- Add the protocol to the existing private class extensions, matching
  how each class already declares the protocols it conforms to
- Leave the implementations alone; AppKit already finds them by
  selector, so this only tells the compiler what it is looking at
@goneng
goneng force-pushed the clear-appkit-deprecation-warnings branch from 27e8e2f to 7da8163 Compare August 22, 2026 00:31
@hannesa2
hannesa2 merged commit 4bd4600 into gitx:master Aug 22, 2026
3 checks passed
@goneng
goneng deleted the clear-appkit-deprecation-warnings branch August 22, 2026 07:00
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