[AppKit] Add bindings for the new APIs in Xcode 27.#25777
Conversation
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>
There was a problem hiding this comment.
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.). |
| [Mac (27, 0), NoMacCatalyst] | ||
| [BaseType (typeof (NSObject))] | ||
| interface NSStatusItemExpandedInterfaceSession { | ||
| [Export ("cancel")] |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| #if XAMCORE_5_0 | ||
| [Abstract] | ||
| #endif |
There was a problem hiding this comment.
Adding [Abstract] is no longer a breaking change, so the #if XAMCORE_5_0 ... #endif condition can be removed.
| [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); |
There was a problem hiding this comment.
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);|
|
||
| [Mac (27, 0)] | ||
| [Export ("widthValueTypeForLayer:rectEdge:")] | ||
| NSTextBlockValueType WidthValueTypeForLayer (NSTextBlockLayer layer, CGRectEdge rectEdge); |
There was a problem hiding this comment.
| NSTextBlockValueType WidthValueTypeForLayer (NSTextBlockLayer layer, CGRectEdge rectEdge); | |
| NSTextBlockValueType GetWidthValueType (NSTextBlockLayer layer, CGRectEdge rectEdge); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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>
✅ [PR Build #1272c3e] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #1272c3e] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
✅ [PR Build #1272c3e] Build passed (Build macOS tests) ✅Pipeline on Agent |
🚀 [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 macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
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.