Skip to content

PencilKit iOS xcode16.0 b3

Rolf Bjarne Kvinge edited this page Jul 9, 2024 · 2 revisions

#PencilKit.framework

diff -ruN /Applications/Xcode_16.0.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPicker.h /Applications/Xcode_16.0.0-beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPicker.h
--- /Applications/Xcode_16.0.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPicker.h	2024-06-15 11:04:28
+++ /Applications/Xcode_16.0.0-beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPicker.h	2024-06-30 21:59:52
@@ -46,7 +46,21 @@
 
 @end
 
+API_AVAILABLE(ios(18.0), visionos(2.0))
+NS_SWIFT_UI_ACTOR
+NS_SWIFT_NAME(PKToolPicker.Delegate)
+@protocol PKToolPickerDelegate <NSObject>
 
+@optional
+
+/// This is called when the user dismisses the tool picker using a built-in control.
+/// This is **not** called when the tool picker hides from a responder change or other programatic request.
+/// By default, using the dismissal control on the tool picker causes the tool picker to resign the first responder.
+/// The delegate may override that default behavior, taking responsibility for the dismissal of the picker, by returning true from this method.
+- (BOOL)toolPickerWillDismiss:(PKToolPicker *)toolPicker API_AVAILABLE(visionos(2.0)) API_UNAVAILABLE(ios);
+
+@end
+
 /// A user interface for selecting a PKTool.
 API_AVAILABLE(ios(13.0))
 @interface PKToolPicker : NSObject
@@ -66,6 +80,9 @@
 /// @param responder  The first responder for which this visible state applies.
 - (void)setVisible:(BOOL)visible forFirstResponder:(UIResponder *)responder;
 
+/// The delegate for the tool picker.
+@property (nonatomic, weak, nullable) id<PKToolPickerDelegate> delegate API_AVAILABLE(ios(18.0), visionos(2.0));
+
 /// The currently selected tool.
 @property (nonatomic, strong) PKTool *selectedTool API_DEPRECATED("Use selectedToolItem instead.", ios(13_0, 18_0), visionos(1_0, 2_0)) NS_REFINED_FOR_SWIFT;
 
@@ -75,7 +92,7 @@
 
 /// The identifier of the selected tool item.
 /// Setting it to an identifier without a matching item in this picker has no effect.
-@property (nonatomic, copy, nullable) NSString *selectedToolItemIdentifier API_AVAILABLE(ios(18.0), visionos(2.0));
+@property (nonatomic, copy) NSString *selectedToolItemIdentifier API_AVAILABLE(ios(18.0), visionos(2.0));
 
 /// All tool items within the picker.
 @property (nonatomic, readonly) NSArray<PKToolPickerItem *> *toolItems API_AVAILABLE(ios(18.0), visionos(2.0));
@@ -123,6 +140,13 @@
 ///
 /// By default this is true.
 @property (nonatomic) BOOL showsDrawingPolicyControls API_AVAILABLE(ios(14.0));
+
+/// If this is true the tool picker may show UI that allows dismissing it.
+/// If this is false the tool picker will not show this UI.
+/// By default this resigns first responder, but is customizable by `PKToolPickerDelegate`'s `toolPickerWillDismiss...` method.
+///
+/// By default this is true on supported platforms.
+@property (nonatomic) BOOL prefersDismissalControl API_AVAILABLE(visionos(2.0)) API_UNAVAILABLE(ios);
 
 /// If this is non-nil, the tool picker will display this item when the tool picker is displayed in supported expanded configurations.
 @property (nonatomic, strong, nullable) UIBarButtonItem *accessoryItem API_AVAILABLE(ios(18.0), visionos(2.0));
diff -ruN /Applications/Xcode_16.0.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerCustomItem.h /Applications/Xcode_16.0.0-beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerCustomItem.h
--- /Applications/Xcode_16.0.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerCustomItem.h	2024-06-21 04:47:45
+++ /Applications/Xcode_16.0.0-beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerCustomItem.h	2024-06-30 21:59:52
@@ -28,6 +28,10 @@
 /// The current color of the custom tool item.
 @property (nonatomic, strong) UIColor *color;
 
+/// Present color selection UI to the user.
+/// Defaults to the value set in `configuration`.
+@property (nonatomic, assign) BOOL allowsColorSelection;
+
 /// The current width of the custom tool item.
 @property (nonatomic, assign) CGFloat width;
 
diff -ruN /Applications/Xcode_16.0.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerCustomItemConfiguration.h /Applications/Xcode_16.0.0-beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerCustomItemConfiguration.h
--- /Applications/Xcode_16.0.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerCustomItemConfiguration.h	2024-06-21 04:47:45
+++ /Applications/Xcode_16.0.0-beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerCustomItemConfiguration.h	2024-06-30 21:59:52
@@ -15,6 +15,20 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+/// Options for which controls to present.
+API_AVAILABLE(ios(18.0), visionos(2.0))
+typedef NS_OPTIONS(NSUInteger, PKToolPickerCustomItemControlOptions) {
+    
+    /// Present neither a width nor opacity control.
+    PKToolPickerCustomItemControlNone    = 0,
+    
+    /// Present a width control if width adjustment is supported.
+    PKToolPickerCustomItemControlWidth   = 1 << 0,
+    
+    /// Present an opacity control if color adjustment is supported.
+    PKToolPickerCustomItemControlOpacity = 1 << 1
+} NS_SWIFT_NAME(PKToolPickerCustomItem.ControlOptions);
+
 /// A configuration that specifies the appearance and behavior of a item and its contents.
 NS_REFINED_FOR_SWIFT
 API_AVAILABLE(ios(18.0), visionos(2.0))
@@ -58,8 +73,15 @@
 @property (nonatomic, strong) UIColor *defaultColor;
 
 /// Present color selection UI to the user.
+/// Note that the custom item has a mutable version of this property. This property provides its initial value.
 /// Default value is NO.
 @property (nonatomic, assign) BOOL allowsColorSelection;
+
+/// Defines which attribute controls are available to be presented in UI such as the tool attributes popover, or inline in the picker presented from a pencil squeeze.
+/// Controls for properties which the tool item does not support will not be presented. Excluding a control here does not hide all UI for adjusting that value.
+/// For example, excluding the opacity control here will not remove it from the color picker, if the color picker is otherwise available.
+/// Defaults to all controls.
+@property (nonatomic, assign) PKToolPickerCustomItemControlOptions toolAttributeControls;
 
 @end
 
diff -ruN /Applications/Xcode_16.0.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerInkingItem.h /Applications/Xcode_16.0.0-beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerInkingItem.h
--- /Applications/Xcode_16.0.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerInkingItem.h	2024-06-21 04:47:45
+++ /Applications/Xcode_16.0.0-beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/PencilKit.framework/Headers/PKToolPickerInkingItem.h	2024-06-30 21:59:52
@@ -19,21 +19,39 @@
 API_AVAILABLE(ios(18.0), visionos(2.0))
 @interface PKToolPickerInkingItem : PKToolPickerItem
 
-/// Create a new tool picker item with an PKInkType.
+/// Create a new tool picker item with a `PKInkType`.
 /// @param inkType The ink type for the tool.
+- (instancetype)initWithInkType:(PKInkType)inkType NS_REFINED_FOR_SWIFT;
+
+/// Create a new tool picker item with a `PKInkType`.
+/// @param inkType The ink type for the tool.
 /// @param color The color for the tool.
+- (instancetype)initWithInkType:(PKInkType)inkType color:(UIColor *)color NS_REFINED_FOR_SWIFT;
+
+/// Create a new tool picker item with a `PKInkType`.
+/// @param inkType The ink type for the tool.
 /// @param width The width for the tool.
+- (instancetype)initWithInkType:(PKInkType)inkType width:(CGFloat)width NS_REFINED_FOR_SWIFT;
+
+/// Create a new tool picker item with a `PKInkType`.
+/// @param inkType The ink type for the tool.
+/// @param color The color for the tool.
+/// @param width The width for the tool.
 - (instancetype)initWithInkType:(PKInkType)inkType color:(UIColor *)color width:(CGFloat)width NS_REFINED_FOR_SWIFT;
 
-/// Create a new tool picker item with an PKInkType.
+/// Create a new tool picker item with a `PKInkType`.
 /// @param inkType The ink type for the tool.
 /// @param color The color for the tool.
 /// @param width The width for the tool.
 /// @param identifier The identifier for the tool item. Passing `nil` resolves to a default value based on the `PKInkType`.
 - (instancetype)initWithInkType:(PKInkType)inkType color:(UIColor *)color width:(CGFloat)width identifier:(nullable NSString *)identifier NS_REFINED_FOR_SWIFT;
 
-/// A tool for drawing on a PKCanvasView.
+/// A tool for drawing on a `PKCanvasView`.
 @property (nonatomic, readonly) PKInkingTool *inkingTool NS_REFINED_FOR_SWIFT;
+
+/// Present color selection UI to the user.
+/// Default value is YES.
+@property (nonatomic, assign) BOOL allowsColorSelection;
 
 @end
Clone this wiki locally