Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PencilKit] Implement Xcode 16.0 beta 1-6 changes. #21148

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 190 additions & 1 deletion src/pencilkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
using UIColor = AppKit.NSColor;
using UIImage = AppKit.NSImage;

using UIBarButtonItem = Foundation.NSObject;
using UIScrollViewDelegate = Foundation.NSObjectProtocol;
using UIScrollView = Foundation.NSObject;
using UIGestureRecognizer = Foundation.NSObject;
using UIResponder = Foundation.NSObject;
using UIView = Foundation.NSObject;
using UIViewController = Foundation.NSObject;
using UIWindow = Foundation.NSObject;
using UIUserInterfaceStyle = Foundation.NSObject;
using BezierPath = AppKit.NSBezierPath;
Expand Down Expand Up @@ -131,7 +133,6 @@ interface PKCanvasView : PKToolPickerObserver {
// [Export ("delegate", ArgumentSemantic.Weak), NullAllowed]
// NSObject WeakDelegate { get; set; }

[Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using Catalyst on macOS.")]
[Wrap ("WeakDelegate"), NullAllowed, New]
IPKCanvasViewDelegate Delegate { get; set; }

Expand Down Expand Up @@ -160,6 +161,14 @@ interface PKCanvasView : PKToolPickerObserver {
[iOS (17, 0), MacCatalyst (17, 0)]
[Export ("maximumSupportedContentVersion", ArgumentSemantic.Assign)]
PKContentVersion MaximumSupportedContentVersion { get; set; }

[iOS (18, 0), MacCatalyst (18, 0)]
[Export ("drawingEnabled")]
bool DrawingEnabled {
[Bind ("isDrawingEnabled")]
get;
set;
}
}

[iOS (13, 0)]
Expand Down Expand Up @@ -323,6 +332,8 @@ interface IPKToolPickerObserver { }
[Protocol]
interface PKToolPickerObserver {

[Deprecated (PlatformName.iOS, 18, 0, message: "Use 'SelectedToolItemDidChange' instead.")]
[Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Use 'SelectedToolItemDidChange' instead.")]
[Export ("toolPickerSelectedToolDidChange:")]
void SelectedToolDidChange (PKToolPicker toolPicker);

Expand All @@ -334,6 +345,10 @@ interface PKToolPickerObserver {

[Export ("toolPickerFramesObscuredDidChange:")]
void FramesObscuredDidChange (PKToolPicker toolPicker);

[iOS (18, 0), MacCatalyst (18, 0)]
[Export ("toolPickerSelectedToolItemDidChange:")]
void SelectedToolItemDidChange (PKToolPicker toolPicker);
}

[iOS (13, 0), NoMac]
Expand All @@ -347,6 +362,10 @@ interface PKToolPicker {
[Export ("init")]
NativeHandle Constructor ();

[iOS (18, 0), MacCatalyst (18, 0)]
[Export ("initWithToolItems:")]
NativeHandle Constructor (PKToolPickerItem [] items);

[Export ("addObserver:")]
void AddObserver (IPKToolPickerObserver observer);

Expand All @@ -356,6 +375,8 @@ interface PKToolPicker {
[Export ("setVisible:forFirstResponder:")]
void SetVisible (bool visible, UIResponder responder);

[Deprecated (PlatformName.iOS, 18, 0, message: "Use 'SelectedToolItem' instead.")]
[Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Use 'SelectedToolItem' instead.")]
[Export ("selectedTool", ArgumentSemantic.Strong)]
PKTool SelectedTool { get; set; }

Expand Down Expand Up @@ -395,6 +416,31 @@ interface PKToolPicker {
[iOS (17, 0), MacCatalyst (17, 0)]
[Export ("maximumSupportedContentVersion", ArgumentSemantic.Assign)]
PKContentVersion MaximumSupportedContentVersion { get; set; }

[iOS (18, 0), MacCatalyst (18, 0)]
[Export ("selectedToolItem", ArgumentSemantic.Strong)]
PKToolPickerItem SelectedToolItem { get; set; }

[iOS (18, 0), MacCatalyst (18, 0)]
[Export ("selectedToolItemIdentifier", ArgumentSemantic.Copy)]
string SelectedToolItemIdentifier { get; set; }

[iOS (18, 0), MacCatalyst (18, 0)]
[Export ("toolItems")]
PKToolPickerItem [] ToolItems { get; }

[iOS (18, 0), MacCatalyst (18, 0)]
[Export ("accessoryItem", ArgumentSemantic.Strong), NullAllowed]
UIBarButtonItem AccessoryItem { get; set; }

[iOS (18, 0), MacCatalyst (18, 0)]
[Export ("delegate", ArgumentSemantic.Weak), NullAllowed]
NSObject WeakDelegate { get; set; }

[iOS (18, 0), MacCatalyst (18, 0)]
[Wrap ("WeakDelegate"), NullAllowed]
IPKToolPickerDelegate Delegate { get; set; }

}

[Mac (11, 0), iOS (14, 0)]
Expand Down Expand Up @@ -563,4 +609,147 @@ interface PKStrokePoint : NSCopying {
[Export ("secondaryScale")]
nfloat SecondaryScale { get; }
}

[iOS (18, 0), MacCatalyst (18, 0), NoMac]
[BaseType (typeof (PKToolPickerItem))]
[DisableDefaultCtor]
interface PKToolPickerCustomItem {
[Export ("initWithConfiguration:")]
NativeHandle Constructor (PKToolPickerCustomItemConfiguration configuration);

[Export ("configuration")]
PKToolPickerCustomItemConfiguration Configuration { get; }

[Export ("color", ArgumentSemantic.Strong)]
UIColor Color { get; set; }

[Export ("allowsColorSelection", ArgumentSemantic.Assign)]
bool AllowsColorSelection { get; set; }

[Export ("width", ArgumentSemantic.Assign)]
nfloat Width { get; set; }

[Export ("reloadImage")]
void ReloadImage ();
}

delegate UIImage PKToolPickerCustomItemConfigurationImageProviderCallback (PKToolPickerCustomItem toolPickerItem);
delegate UIViewController PKToolPickerCustomItemConfigurationViewControllerProvider (PKToolPickerCustomItem toolPickerItem);

[iOS (18, 0), MacCatalyst (18, 0), NoMac]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface PKToolPickerCustomItemConfiguration : NSCopying {
[Export ("initWithIdentifier:name:")]
NativeHandle Constructor (string identifier, string name);

[Export ("identifier", ArgumentSemantic.Copy)]
string Identifier { get; set; }

[Export ("name", ArgumentSemantic.Copy)]
string Name { get; set; }

[Export ("imageProvider", ArgumentSemantic.Copy), NullAllowed]
PKToolPickerCustomItemConfigurationImageProviderCallback ImageProvider { get; set; }

[Export ("viewControllerProvider", ArgumentSemantic.Copy), NullAllowed]
PKToolPickerCustomItemConfigurationViewControllerProvider ViewControllerProvider { get; set; }

[Export ("defaultWidth", ArgumentSemantic.Assign)]
nfloat DefaultWidth { get; set; }

[Export ("widthVariants", ArgumentSemantic.Copy)]
NSDictionary<NSNumber, UIImage> WidthVariants { get; set; }

[Export ("defaultColor", ArgumentSemantic.Strong)]
UIColor DefaultColor { get; set; }

[Export ("allowsColorSelection", ArgumentSemantic.Assign)]
bool AllowsColorSelection { get; set; }

[Export ("toolAttributeControls", ArgumentSemantic.Assign)]
PKToolPickerCustomItemControlOptions ToolAttributeControls { get; set; }
}

[iOS (18, 0), MacCatalyst (18, 0), NoMac]
[BaseType (typeof (PKToolPickerItem))]
[DisableDefaultCtor]
interface PKToolPickerEraserItem {
[Export ("initWithEraserType:")]
NativeHandle Constructor (PKEraserType eraserType);

[Export ("initWithEraserType:width:")]
NativeHandle Constructor (PKEraserType eraserType, nfloat width);

[Export ("eraserTool")]
PKEraserTool EraserTool { get; }
}

[iOS (18, 0), MacCatalyst (18, 0), NoMac]
[BaseType (typeof (PKToolPickerItem))]
[DisableDefaultCtor]
interface PKToolPickerInkingItem {
[Export ("initWithInkType:")]
NativeHandle Constructor (PKInkType inkType);

[Export ("initWithInkType:color:")]
NativeHandle Constructor (PKInkType inkType, UIColor color);

[Export ("initWithInkType:width:")]
NativeHandle Constructor (PKInkType inkType, nfloat width);

[Export ("initWithInkType:color:width:")]
NativeHandle Constructor (PKInkType inkType, UIColor color, nfloat width);

[Export ("initWithInkType:color:width:identifier:")]
NativeHandle Constructor (PKInkType inkType, UIColor color, nfloat width, [NullAllowed] string identifier);

[Export ("inkingTool")]
PKInkingTool InkingTool { get; }

[Export ("allowsColorSelection", ArgumentSemantic.Assign)]
bool AllowsColorSelection { get; set; }
}

[iOS (18, 0), MacCatalyst (18, 0), NoMac]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface PKToolPickerItem : NSCopying {
[Export ("identifier")]
string Identifier { get; }
}

[iOS (18, 0), MacCatalyst (18, 0), NoMac]
[BaseType (typeof (PKToolPickerItem))]
interface PKToolPickerLassoItem {
[Export ("lassoTool")]
PKLassoTool LassoTool { get; }
}

[iOS (18, 0), MacCatalyst (18, 0), NoMac]
[BaseType (typeof (PKToolPickerItem))]
interface PKToolPickerRulerItem {
}

[iOS (18, 0), MacCatalyst (18, 0), NoMac]
[BaseType (typeof (PKToolPickerItem))]
interface PKToolPickerScribbleItem {
}

[iOS (18, 0), MacCatalyst (18, 0), NoMac]
[Protocol (BackwardsCompatibleCodeGeneration = false), Model]
[BaseType (typeof (NSObject))]
interface PKToolPickerDelegate {
}

interface IPKToolPickerDelegate { }

[iOS (18, 0), MacCatalyst (18, 0), NoMac]
[Native]
[Flags]
enum PKToolPickerCustomItemControlOptions : ulong {
None = 0,
Width = 1 << 0,
Opacity = 1 << 1
}
}
39 changes: 39 additions & 0 deletions tests/cecil-tests/Documentation.KnownFailures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16516,6 +16516,9 @@ F:PencilKit.PKInkType.Monoline
F:PencilKit.PKInkType.Pen
F:PencilKit.PKInkType.Pencil
F:PencilKit.PKInkType.Watercolor
F:PencilKit.PKToolPickerCustomItemControlOptions.None
F:PencilKit.PKToolPickerCustomItemControlOptions.Opacity
F:PencilKit.PKToolPickerCustomItemControlOptions.Width
F:Phase.PhaseAssetError.AlreadyExists
F:Phase.PhaseAssetError.BadParameters
F:Phase.PhaseAssetError.FailedToLoad
Expand Down Expand Up @@ -44627,11 +44630,13 @@ M:PencilKit.IPKCanvasViewDelegate.EndUsingTool(PencilKit.PKCanvasView)
M:PencilKit.IPKToolPickerObserver.FramesObscuredDidChange(PencilKit.PKToolPicker)
M:PencilKit.IPKToolPickerObserver.IsRulerActiveDidChange(PencilKit.PKToolPicker)
M:PencilKit.IPKToolPickerObserver.SelectedToolDidChange(PencilKit.PKToolPicker)
M:PencilKit.IPKToolPickerObserver.SelectedToolItemDidChange(PencilKit.PKToolPicker)
M:PencilKit.IPKToolPickerObserver.VisibilityDidChange(PencilKit.PKToolPicker)
M:PencilKit.PKCanvasView.FramesObscuredDidChange(PencilKit.PKToolPicker)
M:PencilKit.PKCanvasView.IsRulerActiveDidChange(PencilKit.PKToolPicker)
M:PencilKit.PKCanvasView.PKCanvasViewAppearance.#ctor(System.IntPtr)
M:PencilKit.PKCanvasView.SelectedToolDidChange(PencilKit.PKToolPicker)
M:PencilKit.PKCanvasView.SelectedToolItemDidChange(PencilKit.PKToolPicker)
M:PencilKit.PKCanvasView.VisibilityDidChange(PencilKit.PKToolPicker)
M:PencilKit.PKCanvasViewDelegate_Extensions.DidBeginUsingTool(PencilKit.IPKCanvasViewDelegate,PencilKit.PKCanvasView)
M:PencilKit.PKCanvasViewDelegate_Extensions.DidFinishRendering(PencilKit.IPKCanvasViewDelegate,PencilKit.PKCanvasView)
Expand Down Expand Up @@ -44704,14 +44709,23 @@ M:PencilKit.PKStrokePoint.#ctor(CoreGraphics.CGPoint,System.Double,CoreGraphics.
M:PencilKit.PKStrokePoint.Copy(Foundation.NSZone)
M:PencilKit.PKTool.Copy(Foundation.NSZone)
M:PencilKit.PKToolPicker.#ctor
M:PencilKit.PKToolPicker.#ctor(PencilKit.PKToolPickerItem[])
M:PencilKit.PKToolPicker.AddObserver(PencilKit.IPKToolPickerObserver)
M:PencilKit.PKToolPicker.Dispose(System.Boolean)
M:PencilKit.PKToolPicker.GetFrameObscured(UIKit.UIView)
M:PencilKit.PKToolPicker.GetSharedToolPicker(UIKit.UIWindow)
M:PencilKit.PKToolPicker.RemoveObserver(PencilKit.IPKToolPickerObserver)
M:PencilKit.PKToolPicker.SetVisible(System.Boolean,UIKit.UIResponder)
M:PencilKit.PKToolPickerCustomItem.ReloadImage
M:PencilKit.PKToolPickerCustomItemConfiguration.Copy(Foundation.NSZone)
M:PencilKit.PKToolPickerInkingItem.#ctor(PencilKit.PKInkType,System.Runtime.InteropServices.NFloat)
M:PencilKit.PKToolPickerInkingItem.#ctor(PencilKit.PKInkType,UIKit.UIColor)
M:PencilKit.PKToolPickerInkingItem.#ctor(PencilKit.PKInkType)
M:PencilKit.PKToolPickerItem.Copy(Foundation.NSZone)
M:PencilKit.PKToolPickerObserver_Extensions.FramesObscuredDidChange(PencilKit.IPKToolPickerObserver,PencilKit.PKToolPicker)
M:PencilKit.PKToolPickerObserver_Extensions.IsRulerActiveDidChange(PencilKit.IPKToolPickerObserver,PencilKit.PKToolPicker)
M:PencilKit.PKToolPickerObserver_Extensions.SelectedToolDidChange(PencilKit.IPKToolPickerObserver,PencilKit.PKToolPicker)
M:PencilKit.PKToolPickerObserver_Extensions.SelectedToolItemDidChange(PencilKit.IPKToolPickerObserver,PencilKit.PKToolPicker)
M:PencilKit.PKToolPickerObserver_Extensions.VisibilityDidChange(PencilKit.IPKToolPickerObserver,PencilKit.PKToolPicker)
M:Phase.PhaseAmbientMixerDefinition.#ctor(AVFoundation.AVAudioChannelLayout,System.Numerics.Quaternion,Foundation.NSString)
M:Phase.PhaseAmbientMixerDefinition.#ctor(AVFoundation.AVAudioChannelLayout,System.Numerics.Quaternion)
Expand Down Expand Up @@ -73812,6 +73826,7 @@ P:PdfKit.PdfViewUrlEventArgs.Url
P:PencilKit.PKCanvasView.AllowsFingerDrawing
P:PencilKit.PKCanvasView.Delegate
P:PencilKit.PKCanvasView.Drawing
P:PencilKit.PKCanvasView.DrawingEnabled
P:PencilKit.PKCanvasView.DrawingGestureRecognizer
P:PencilKit.PKCanvasView.DrawingPolicy
P:PencilKit.PKCanvasView.MaximumSupportedContentVersion
Expand Down Expand Up @@ -73850,13 +73865,24 @@ P:PencilKit.PKStrokePoint.Opacity
P:PencilKit.PKStrokePoint.SecondaryScale
P:PencilKit.PKStrokePoint.Size
P:PencilKit.PKStrokePoint.TimeOffset
P:PencilKit.PKToolPicker.AccessoryItem
P:PencilKit.PKToolPicker.ColorUserInterfaceStyle
P:PencilKit.PKToolPicker.Delegate
P:PencilKit.PKToolPicker.IsVisible
P:PencilKit.PKToolPicker.MaximumSupportedContentVersion
P:PencilKit.PKToolPicker.OverrideUserInterfaceStyle
P:PencilKit.PKToolPicker.RulerActive
P:PencilKit.PKToolPicker.SelectedToolItem
P:PencilKit.PKToolPicker.SelectedToolItemIdentifier
P:PencilKit.PKToolPicker.ShowsDrawingPolicyControls
P:PencilKit.PKToolPicker.StateAutosaveName
P:PencilKit.PKToolPicker.ToolItems
P:PencilKit.PKToolPicker.WeakDelegate
P:PencilKit.PKToolPickerCustomItem.AllowsColorSelection
P:PencilKit.PKToolPickerCustomItem.Color
P:PencilKit.PKToolPickerCustomItem.Width
P:PencilKit.PKToolPickerInkingItem.AllowsColorSelection
P:PencilKit.PKToolPickerItem.Identifier
P:Phase.PhaseAmbientMixerDefinition.InputChannelLayout
P:Phase.PhaseAmbientMixerDefinition.Orientation
P:Phase.PhaseAsset.Identifier
Expand Down Expand Up @@ -83435,6 +83461,7 @@ T:PdfKit.PdfViewUrlEventArgs
T:PdfKit.PdfWidgetCellState
T:PdfKit.PdfWidgetControlType
T:PencilKit.IPKCanvasViewDelegate
T:PencilKit.IPKToolPickerDelegate
T:PencilKit.IPKToolPickerObserver
T:PencilKit.PKCanvasView
T:PencilKit.PKCanvasViewDelegate
Expand All @@ -83453,6 +83480,18 @@ T:PencilKit.PKStroke
T:PencilKit.PKStrokePath
T:PencilKit.PKStrokePoint
T:PencilKit.PKToolPicker
T:PencilKit.PKToolPickerCustomItem
T:PencilKit.PKToolPickerCustomItemConfiguration
T:PencilKit.PKToolPickerCustomItemConfigurationImageProviderCallback
T:PencilKit.PKToolPickerCustomItemConfigurationViewControllerProvider
T:PencilKit.PKToolPickerCustomItemControlOptions
T:PencilKit.PKToolPickerDelegate
T:PencilKit.PKToolPickerEraserItem
T:PencilKit.PKToolPickerInkingItem
T:PencilKit.PKToolPickerItem
T:PencilKit.PKToolPickerLassoItem
T:PencilKit.PKToolPickerRulerItem
T:PencilKit.PKToolPickerScribbleItem
T:Phase.PhaseAmbientMixerDefinition
T:Phase.PhaseAsset
T:Phase.PhaseAssetError
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# adding these since weak delegate exists in base class
!missing-selector! PKCanvasView::delegate not bound
!missing-selector! PKCanvasView::setDelegate: not bound
Loading