Skip to content

[AppKit] Add bindings for the new APIs in Xcode 27.#25777

Open
dalexsoto wants to merge 9 commits into
xcode27.0from
dev/alex/xc27-appkit
Open

[AppKit] Add bindings for the new APIs in Xcode 27.#25777
dalexsoto wants to merge 9 commits into
xcode27.0from
dev/alex/xc27-appkit

Conversation

@dalexsoto

Copy link
Copy Markdown
Member

Bind the missing AppKit APIs reported by xtro for Xcode 27, emptying macOS-AppKit.todo and MacCatalyst-AppKit.todo.

New types: NSViewCornerRadius, NSViewCornerConfiguration, NSViewCornerRadii, NSRefreshController, NSStatusItemExpandedInterfaceSession and NSTextSelectionManager.

New protocols: NSStatusItemExpandedInterfaceDelegate, NSTextSelectionManagerDelegate and the NSTextViewportRenderingSurface / NSTextViewportRenderingSurfaceKey marker protocols.

New enums: NSControlEvents, NSMenuItemImageVisibility, NSScreenTouchCapabilities, NSSegmentedControlRole, NSTextSelectionMode, NSToolbarItemGroupRole, NSTextAttachmentViewProviderReusePolicy, NSViewExclusiveGestureBehavior and the NSApplicationPresentationDisableScreenCornerInteractions option.

New members on NSView, NSControl, NSScrollView, NSScreen, NSMenuItem, NSSegmentedControl, NSStatusItem, NSTextView, NSTextBlock, NSBrowserDelegate, NSGestureRecognizer, NSPanGestureRecognizer, NSGlassEffectView and NSEvent, plus the new NSTextAlignmentToCTTextAlignment / NSTextAlignmentFromCTTextAlignment P/Invokes (covered by a new monotouch-test).

Also deprecate NSPanGestureRecognizer.NumberOfTouchesRequired, fix the nullability of the new NSView corner properties, NSStatusItem.ExpandedInterfaceSession and NSTextBlock.DrawBackground, and make NSPaperMarginDocumentAttribute available on macOS.

The shared TextKit changes in xkit.cs (NSTextLayoutManagerDelegate, NSTextLocation, NSTextLayoutFragment and NSTextViewportLayoutControllerDelegate) also resolve the equivalent entries in the iOS, tvOS and Mac Catalyst UIKit .todo files.

Bind the missing AppKit APIs reported by xtro for Xcode 27, emptying
macOS-AppKit.todo and MacCatalyst-AppKit.todo.

New types: NSViewCornerRadius, NSViewCornerConfiguration, NSViewCornerRadii,
NSRefreshController, NSStatusItemExpandedInterfaceSession and
NSTextSelectionManager.

New protocols: NSStatusItemExpandedInterfaceDelegate,
NSTextSelectionManagerDelegate and the NSTextViewportRenderingSurface /
NSTextViewportRenderingSurfaceKey marker protocols.

New enums: NSControlEvents, NSMenuItemImageVisibility, NSScreenTouchCapabilities,
NSSegmentedControlRole, NSTextSelectionMode, NSToolbarItemGroupRole,
NSTextAttachmentViewProviderReusePolicy, NSViewExclusiveGestureBehavior and the
NSApplicationPresentationDisableScreenCornerInteractions option.

New members on NSView, NSControl, NSScrollView, NSScreen, NSMenuItem,
NSSegmentedControl, NSStatusItem, NSTextView, NSTextBlock, NSBrowserDelegate,
NSGestureRecognizer, NSPanGestureRecognizer, NSGlassEffectView and NSEvent, plus
the new NSTextAlignmentToCTTextAlignment / NSTextAlignmentFromCTTextAlignment
P/Invokes (covered by a new monotouch-test).

Also deprecate NSPanGestureRecognizer.NumberOfTouchesRequired, fix the
nullability of the new NSView corner properties, NSStatusItem.ExpandedInterfaceSession
and NSTextBlock.DrawBackground, and make NSPaperMarginDocumentAttribute available
on macOS.

The shared TextKit changes in xkit.cs (NSTextLayoutManagerDelegate, NSTextLocation,
NSTextLayoutFragment and NSTextViewportLayoutControllerDelegate) also resolve the
equivalent entries in the iOS, tvOS and Mac Catalyst UIKit .todo files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the AppKit (and shared TextKit) bindings to cover the newly introduced APIs in Xcode 27, and updates the xtro-sharpie .todo/.ignore lists plus test coverage to reflect the new surface area.

Changes:

  • Added new AppKit bindings (types/protocols/enums/members) for Xcode 27, including corner configuration APIs, refresh controller, status item expanded interface, new control/menu/screen enums, and additional selectors.
  • Added shared TextKit protocol bindings and updated introspection skipping for an Xcode 27 runtime/header mismatch.
  • Updated xtro-sharpie todo/ignore files and added a new monotouch-test validating NSTextAlignment ↔ CTTextAlignment conversion P/Invokes.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/xtro-sharpie/api-annotations-dotnet/tvOS-UIKit.todo Removes resolved TextKit-related todo entries.
tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.todo Emptied by binding the missing AppKit APIs (file removed).
tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore Adds ignores for NSTextLocation required-member abstractness deferral.
tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.todo Removes resolved TextKit-related todo entries.
tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AppKit.todo Emptied by binding the missing AppKit APIs (file removed).
tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.todo Removes resolved TextKit-related todo entries.
tests/xtro-sharpie/api-annotations-dotnet/common-UIKit.ignore Adds ignores for NSTextLocation required-member abstractness deferral.
tests/monotouch-test/AppKit/NSTextAlignmentConversionTest.cs New test validating NSTextAlignment/CTTextAlignment conversion wrappers.
tests/introspection/ApiProtocolTest.cs Skips a known Xcode 27 runtime mismatch for marker protocol conformance.
tests/cecil-tests/Documentation.KnownFailures.txt Adds doc known-failure entries for newly bound enum values/members.
src/xkit.cs Adds shared TextKit protocol members and marker protocols (viewport rendering surface/key).
src/AppKit/Functions.cs Adds P/Invoke wrappers for NSTextAlignment ↔ CTTextAlignment conversion functions.
src/AppKit/Enums.cs Adds NSApplicationPresentationOptions.DisableScreenCornerInteractions.
src/appkit.cs Adds new AppKit bindings (NSControlEvents, NSRefreshController, status item expanded interface, corner APIs, etc.).

Comment thread src/appkit.cs
Comment on lines +18496 to +18499
[Mac (27, 0), NoMacCatalyst]
[BaseType (typeof (NSObject))]
interface NSStatusItemExpandedInterfaceSession {
[Export ("cancel")]
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Comment thread src/xkit.cs Outdated
Comment on lines +4038 to +4040
#if XAMCORE_5_0
[Abstract]
#endif

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding [Abstract] is no longer a breaking change, so the #if XAMCORE_5_0 ... #endif condition can be removed.

Comment thread src/appkit.cs
Comment on lines +6054 to +6060
[Mac (11, 0)]
[Export ("addTarget:action:forControlEvents:")]
void AddTarget ([NullAllowed] NSObject target, Selector action, NSControlEvents controlEvents);

[Mac (11, 0)]
[Export ("removeTarget:action:forControlEvents:")]
void RemoveTarget ([NullAllowed] NSObject target, [NullAllowed] Selector action, NSControlEvents controlEvents);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be done in a separate PR if we decide to do it: having a delegate API would be more C#-like:

void AddTarget (Action action, NSControlEvents controlEvents);
void RemoveTarget (Action action, NSControlEvents controlEvents);

or maybe something like this, where disposing of the return value removes the target:

IDisposable AddTarget (Action action, NSControlEvents controlEvents);

Comment thread src/appkit.cs Outdated

[Mac (27, 0)]
[Export ("widthValueTypeForLayer:rectEdge:")]
NSTextBlockValueType WidthValueTypeForLayer (NSTextBlockLayer layer, CGRectEdge rectEdge);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NSTextBlockValueType WidthValueTypeForLayer (NSTextBlockLayer layer, CGRectEdge rectEdge);
NSTextBlockValueType GetWidthValueType (NSTextBlockLayer layer, CGRectEdge rectEdge);

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

* Make NSTextLocation's isEqual: and hash unconditionally [Abstract] instead
  of gating [Abstract] behind XAMCORE_5_0 (adding [Abstract] to a protocol
  member is no longer a breaking change), and drop the now-unnecessary
  incorrect-protocol-member xtro ignore entries.

* Rename the new NSTextBlock 'widthValueTypeForLayer:rectEdge:' binding from
  WidthValueTypeForLayer to GetWidthValueType to follow .NET naming
  conventions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Xcode 27 beta 2 removed or changed three APIs that were bound for beta 1:

* NSTextLayoutManagerDelegate's
  textLayoutManager:textViewportLayoutControllerForTextContainer: was
  removed from the headers on all platforms.
* NSTextAlignmentToCTTextAlignment and NSTextAlignmentFromCTTextAlignment
  are now API_UNAVAILABLE(macos) (they remain available on iOS/tvOS).

These were unreleased beta 1 bindings, so remove them to match the beta 2
SDK, along with the now-obsolete NSTextAlignmentConversionTest and the
stale Documentation.KnownFailures.txt entries.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

…untime.

NSTextCheckingWaitForAllGrammarCheckingResultsKey and
NSSpellChecker.ignoreGrammarRange:inSentence:inSpellDocumentWithTag: are
declared as macOS 27.0 in the Xcode 27 beta 2 SDK headers, but they are not
present in the macOS 27 beta 2 runtime (introspection can't find them).

Rather than bind them - which would be a breaking change to remove later if
Apple drops them (as happened with other text APIs in beta 2) - leave them
unbound and track them in macOS-AppKit.todo so we revisit them in a future
beta. Also remove the now-stale Documentation.KnownFailures.txt entry for the
removed IgnoreGrammarRange method.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #e1ed9da] Build passed (Build packages) ✅

Pipeline on Agent
Hash: e1ed9da07e6df95a82daa942ba19fcb1387cd62f [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #e1ed9da] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: e1ed9da07e6df95a82daa942ba19fcb1387cd62f [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

❌ [CI Build #a9b9861] Prepare .NET Release failed ❌

The following jobs reported a non-successful result:

Job Result
Sign NuGets ✅ Succeeded
Convert NuGet to MSI ✅ Succeeded
Push NuGets ❌ Failed
📦 Signed NuGet packages (32 packages)

iOS

  • Microsoft.iOS.Ref.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.iOS.Runtime.ios-arm64.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.iOS.Runtime.ios.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.iOS.Runtime.iossimulator-arm64.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.iOS.Runtime.iossimulator-x64.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.iOS.Sdk.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.iOS.Templates.27.0.10099-xcode27.0.nupkg
  • Microsoft.iOS.Windows.Sdk.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.NET.Sdk.iOS.Manifest-10.0.400-preview.0.27.0.10099-xcode27.0.nupkg

MacCatalyst

  • Microsoft.MacCatalyst.Ref.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.MacCatalyst.Runtime.maccatalyst-arm64.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.MacCatalyst.Runtime.maccatalyst-x64.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.MacCatalyst.Runtime.maccatalyst.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.MacCatalyst.Sdk.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.MacCatalyst.Templates.27.0.10099-xcode27.0.nupkg
  • Microsoft.NET.Sdk.MacCatalyst.Manifest-10.0.400-preview.0.27.0.10099-xcode27.0.nupkg

macOS

  • Microsoft.macOS.Ref.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.macOS.Runtime.osx-arm64.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.macOS.Runtime.osx-x64.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.macOS.Runtime.osx.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.macOS.Sdk.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.macOS.Templates.27.0.10099-xcode27.0.nupkg
  • Microsoft.NET.Sdk.macOS.Manifest-10.0.400-preview.0.27.0.10099-xcode27.0.nupkg

tvOS

  • Microsoft.NET.Sdk.tvOS.Manifest-10.0.400-preview.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.tvOS.Ref.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.tvOS.Runtime.tvos-arm64.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.tvOS.Runtime.tvos.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.tvOS.Runtime.tvossimulator-arm64.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.tvOS.Runtime.tvossimulator-x64.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.tvOS.Sdk.net10.0_27.0.27.0.10099-xcode27.0.nupkg
  • Microsoft.tvOS.Templates.27.0.10099-xcode27.0.nupkg

Other

  • Sharpie.Bind.Tool.27.0.0.99-xcode27.0.nupkg

Pipeline on Agent
Hash: a9b9861f7786d59605846010cd29373b7fa34c2e [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #e1ed9da] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: e1ed9da07e6df95a82daa942ba19fcb1387cd62f [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: e1ed9da07e6df95a82daa942ba19fcb1387cd62f [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #e1ed9da] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 2 tests failed, 194 tests passed.

Failures

❌ monotouch tests (macOS)

1 tests failed, 17 tests passed.

Failed tests

  • monotouch-test/macOS/Release (NativeAOT, .NET 11 defaults): Failed (Test run crashed (exit code: 139).
    Test run crashed)

Html Report (VSDrops) Download

❌ Tests on macOS Golden Gate (27) tests [attempt 2]

1 tests failed, 4 tests passed.

Failed tests

  • macOS/osx-arm64 introspection: Failed (exit code 1)
    • [FAIL] Coding : 1 types conforms to NSCoding but does not implement INSCoding: NSViewCornerRadii
    • [FAIL] NSViewCornerRadii conforms to NSCoding but does not implement INSCoding
    • [FAIL] SecureCoding : 1 types conforms to NSSecureCoding but does not implement INSSecureCoding:
    • ... and 1 more failures

Html Report (VSDrops) Download

Successes

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 17 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 18 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: e1ed9da07e6df95a82daa942ba19fcb1387cd62f [PR build]

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants