Skip to content

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

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

[AppKit] Add bindings for the new APIs in Xcode 27.#25777
dalexsoto wants to merge 4 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>
@dalexsoto dalexsoto requested a review from rolfbjarne June 23, 2026 16:58
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

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

Pipeline on Agent
Hash: 1272c3ec66a2257cc4b8da900ff3a685e1393560 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #1272c3e] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 1272c3ec66a2257cc4b8da900ff3a685e1393560 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@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: 1272c3ec66a2257cc4b8da900ff3a685e1393560 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #1272c3e] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 1272c3ec66a2257cc4b8da900ff3a685e1393560 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #1272c3e] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 195 tests passed 🎉

Tests counts

✅ 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 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 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. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 1272c3ec66a2257cc4b8da900ff3a685e1393560 [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