Skip to content

Commit

Permalink
[AppKit/UIKit] Implement Xcode 16.2 beta 1-3 changes. (#21735)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne authored Dec 3, 2024
1 parent b3f98e7 commit aea5fda
Show file tree
Hide file tree
Showing 14 changed files with 572 additions and 164 deletions.
2 changes: 2 additions & 0 deletions src/UIKit/UIEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public enum UIBarButtonSystemItem : long {
[iOS (13, 0), NoTV]
[MacCatalyst (13, 1)]
Close,
[iOS (18, 2), NoTV, MacCatalyst (18, 2)]
WritingTools,
}

// NSUInteger -> UIControl.h
Expand Down
60 changes: 59 additions & 1 deletion src/appkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8635,6 +8635,9 @@ partial interface NSMenu : NSCoding, NSCopying, NSAccessibility, NSAccessibility
[Export ("selectedItems", ArgumentSemantic.Copy)]
NSMenuItem [] SelectedItems { get; set; }

[Mac (15, 2)]
[Export ("automaticallyInsertsWritingToolsItems")]
bool AutomaticallyInsertsWritingToolsItems { get; set; }
}

interface INSMenuDelegate { }
Expand Down Expand Up @@ -8805,6 +8808,11 @@ interface NSMenuItem : NSCoding, NSCopying, NSAccessibility, NSAccessibilityElem
[Mac (14, 4)]
[Export ("subtitle", ArgumentSemantic.Copy), NullAllowed]
string Subtitle { get; set; }

[Static]
[Mac (15, 2)]
[Export ("writingToolsItems", ArgumentSemantic.Copy)]
NSMenuItem [] WritingToolsItems { get; }
}

[NoMacCatalyst]
Expand Down Expand Up @@ -13730,7 +13738,7 @@ interface NSSavePanel {

[Deprecated (PlatformName.MacOSX, 10, 6, message: "Use Begin with the callback instead.")]
[Export ("beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:")]
void Begin (string directory, string filename, NSWindow docWindow, NSObject modalDelegate, Selector selector, IntPtr context);
void Begin ([NullAllowed] string directory, string filename, NSWindow docWindow, NSObject modalDelegate, Selector selector, IntPtr context);

[Deprecated (PlatformName.MacOSX, 10, 6, message: "Use RunModal without parameters instead.")]
[Export ("runModalForDirectory:file:")]
Expand Down Expand Up @@ -15779,6 +15787,10 @@ interface NSStringAttributeKey {
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Field ("NSAdaptiveImageGlyphAttributeName")]
NSString AdaptiveImageGlyph { get; }

[TV (18, 2), Mac (15, 2), iOS (18, 2), MacCatalyst (18, 2)]
[Field ("NSWritingToolsExclusionAttributeName")]
NSString WritingToolsExclusion { get; }
}

delegate NSObject NSStoryboardControllerCreator (NSCoder coder);
Expand Down Expand Up @@ -16999,6 +17011,14 @@ partial interface NSView : NSDraggingDestination, NSAnimatablePropertyContainer,
[Mac (14, 0)]
[Export ("displayLinkWithTarget:selector:")]
CADisplayLink GetDisplayLink (NSObject target, Selector selector);

#if !__MACCATALYST__
// category NSWritingToolsCoordinator (NSView)
[NoMacCatalyst]
[NullAllowed, Export ("writingToolsCoordinator", ArgumentSemantic.Assign)]
[Mac (15, 2)]
NSWritingToolsCoordinator WritingToolsCoordinator { get; set; }
#endif
}

[NoMacCatalyst]
Expand Down Expand Up @@ -18880,6 +18900,10 @@ NSTextContentType ContentType {
[Wrap ("SetContentType (value.GetConstant()!)")]
set;
}

[Mac (15, 2)]
[Export ("allowsWritingTools")]
bool AllowsWritingTools { get; set; }
}

[NoMacCatalyst]
Expand Down Expand Up @@ -20322,6 +20346,10 @@ partial interface NSToolbar {
[Mac (15, 0), MacCatalyst (18, 0)]
[Export ("removeItemWithItemIdentifier:")]
void RemoveItem (string itemIdentifier);

[Mac (15, 2), MacCatalyst (18, 2)]
[Field ("NSToolbarWritingToolsItemIdentifier")]
NSString NSToolbarWritingToolsItemIdentifier { get; }
}

interface INSToolbarDelegate { }
Expand Down Expand Up @@ -28811,4 +28839,34 @@ enum NSToolbarItemVisibilityPriority : long {
High = 1000,
User = 2000,
}

[Category]
[BaseType (typeof (NSResponder))]
[Mac (15, 2), NoMacCatalyst]
interface NSResponder_NSWritingToolsSupport {
[Export ("showWritingTools:")]
void ShowWritingTools ([NullAllowed] NSObject sender);
}

[NoMacCatalyst, Mac (15, 2)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface NSTextPreview {
[Export ("initWithSnapshotImage:presentationFrame:candidateRects:")]
[DesignatedInitializer]
NativeHandle Constructor (CGImage snapshotImage, CGRect presentationFrame, [BindAs (typeof (CGRect []))] NSValue [] candidateRects);

[Export ("initWithSnapshotImage:presentationFrame:")]
NativeHandle Constructor (CGImage snapshotImage, CGRect presentationFrame);

[Export ("previewImage")]
CGImage PreviewImage { get; }

[Export ("presentationFrame")]
CGRect PresentationFrame { get; }

[Export ("candidateRects")]
[BindAs (typeof (CGRect []))]
NSValue [] CandidateRects { get; }
}
}
10 changes: 10 additions & 0 deletions src/foundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4705,6 +4705,16 @@ interface NSError : NSSecureCoding, NSCopying {
[Field ("NSURLErrorBackgroundTaskCancelledReasonKey")]
NSString NSUrlErrorBackgroundTaskCancelledReasonKey { get; }
#endif

#if IOS && !MACCATALYST
[iOS (18, 2), NoMacCatalyst, NoTV, NoMac]
[Field ("UIApplicationCategoryDefaultRetryAvailabilityDateErrorKey", "UIKit")]
NSString UIApplicationCategoryDefaultRetryAvailabilityDateErrorKey { get; }

[iOS (18, 2), NoMacCatalyst, NoTV, NoMac]
[Field ("UIApplicationCategoryDefaultStatusLastProvidedDateErrorKey", "UIKit")]
NSString UIApplicationCategoryDefaultStatusLastProvidedDateErrorKey { get; }
#endif
}

delegate NSObject NSErrorUserInfoValueProvider (NSError error, NSString userInfoKey);
Expand Down
44 changes: 44 additions & 0 deletions src/uikit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3025,6 +3025,10 @@ interface UIApplication {
[TV (17, 0), NoWatch, iOS (17, 0), MacCatalyst (17, 0)]
[Export ("activateSceneSessionForRequest:errorHandler:")]
void ActivateSceneSession (UISceneSessionActivationRequest request, [NullAllowed] Action<NSError> errorHandler);

[iOS (18, 2), MacCatalyst (18, 2), TV (18, 2)]
[Field ("UIApplicationOpenDefaultApplicationsSettingsURLString")]
NSString UIApplicationOpenDefaultApplicationsSettingsUrlString { get; }
}

/// <summary>Icon for a Quick Action shortcut, which appears in response to user-applied pressure.</summary>
Expand Down Expand Up @@ -12845,6 +12849,10 @@ interface UIResponderStandardEditActions {
[TV (16, 0), iOS (16, 0), MacCatalyst (16, 0)]
[Export ("useSelectionForFind:")]
void UseSelectionForFind ([NullAllowed] NSObject sender);

[NoTV, iOS (18, 2), MacCatalyst (18, 2)]
[Export ("showWritingTools:")]
void ShowWritingTools ([NullAllowed] NSObject sender);
}

#if !NET // These two methods are in the UIResponderStandardEditActions protocol
Expand Down Expand Up @@ -14243,6 +14251,10 @@ interface UIStringAttributeKey {
[Field ("NSAdaptiveImageGlyphAttributeName")]
NSString AdaptiveImageGlyph { get; }

[NoTV, Mac (15, 2), iOS (18, 2), MacCatalyst (18, 2)]
[Field ("NSWritingToolsExclusionAttributeName")]
NSString WritingToolsExclusion { get; }

}

/// <summary>A <see cref="T:UIKit.UIControl" /> that displays an on/off switch.</summary>
Expand Down Expand Up @@ -16428,6 +16440,10 @@ NSDictionary TypingAttributes2 {
[NoWatch, NoTV, NoMacCatalyst, iOS (18, 0)]
[Export ("textFormattingConfiguration", ArgumentSemantic.Copy), NullAllowed]
UITextFormattingViewControllerConfiguration TextFormattingConfiguration { get; set; }

[NoTV, MacCatalyst (18, 2), iOS (18, 2)]
[Export ("writingToolsCoordinator")]
UIWritingToolsCoordinator WritingToolsCoordinator { get; }
}

interface IUITextViewDelegate { }
Expand Down Expand Up @@ -30933,4 +30949,32 @@ interface NSObject_UIAccessibilityTextOperations {
void SetAccessibilityTextInputResponderHandler ([NullAllowed] UITextInputReturnHandler handler);
}

[NoTV, NoMacCatalyst, iOS (18, 2)]
[Native]
public enum UIApplicationCategory : long {
UIApplicationCategoryWebBrowser = 1,
}

[NoTV, NoMacCatalyst, iOS (18, 2)]
[Native]
public enum UIApplicationCategoryDefaultStatus : long {
Unavailable,
IsDefault,
NotDefault,
}

[NoTV, NoMacCatalyst, iOS (18, 2)]
[ErrorDomain ("UIApplicationCategoryDefaultErrorDomain")]
[Native]
public enum UIApplicationCategoryDefaultErrorCode : long {
RateLimited = 1,
}

[NoTV, NoMacCatalyst, iOS (18, 2)]
[Category]
[BaseType (typeof (UIApplication))]
interface UIApplication_DefaultApplication {
[Export ("defaultStatusForCategory:error:")]
UIApplicationCategoryDefaultStatus GetDefaultStatus (UIApplicationCategory category, [NullAllowed] out NSError error);
}
}
Loading

6 comments on commit aea5fda

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.