From d883febff0331421d9099ea3192bb9d5d43e72dd Mon Sep 17 00:00:00 2001 From: Alex Soto Date: Tue, 6 Aug 2019 07:53:08 -0400 Subject: [PATCH] [UIKit] Update bindings to Xcode 11 Beta 5 (#6717) --- src/UIKit/UIEnums.cs | 28 +++++- src/uikit.cs | 130 +++++++++++++++++++++++++- tests/xtro-sharpie/iOS-UIKit.ignore | 5 + tests/xtro-sharpie/iOS-UIKit.todo | 40 -------- tests/xtro-sharpie/tvOS-UIKit.ignore | 5 + tests/xtro-sharpie/tvOS-UIKit.todo | 15 --- tests/xtro-sharpie/watchOS-UIKit.todo | 9 -- 7 files changed, 164 insertions(+), 68 deletions(-) diff --git a/src/UIKit/UIEnums.cs b/src/UIKit/UIEnums.cs index 6d1315de1a..9ea31b999b 100644 --- a/src/UIKit/UIEnums.cs +++ b/src/UIKit/UIEnums.cs @@ -95,7 +95,9 @@ namespace UIKit { Undo, Redo, [Deprecated (PlatformName.iOS, 11, 0)] - PageCurl + PageCurl, + [iOS (13,0), NoTV] + Close, } // NSUInteger -> UIControl.h @@ -294,6 +296,8 @@ namespace UIKit { ContactAdd, [TV (11,0)][NoiOS] Plain, + [NoTV, iOS (13,0)] + Close, System = RoundedRect, } @@ -1250,6 +1254,12 @@ namespace UIKit { DefaultHigh = 750, DefaultLow = 250, FittingSizeLevel = 50, + [iOS (13,0)] + DragThatCanResizeScene = 510, + [iOS (13,0)] + SceneSizeStayPut = 500, + [iOS (13,0)] + DragThatCannotResizeScene = 490, } // NSInteger -> NSLayoutConstraint.h @@ -2504,6 +2514,8 @@ namespace UIKit { WritingDirection, [Field ("UIMenuAlignment")] Alignment, + [Field ("UIMenuToolbar")] + Toolbar, [Field ("UIMenuFullscreen")] Fullscreen, [Field ("UIMenuMinimizeAndZoom")] @@ -2648,4 +2660,18 @@ namespace UIKit { Commit = 2, Decline = 3, } + + [NoWatch, NoTV, iOS (13,0)] + public enum UIActivityItemsConfigurationInteraction { + [Field ("UIActivityItemsConfigurationInteractionShare")] + Share, + } + + [NoWatch, NoTV, iOS (13,0)] + public enum UIActivityItemsConfigurationPreviewIntent { + [Field ("UIActivityItemsConfigurationPreviewIntentFullSize")] + FullSize, + [Field ("UIActivityItemsConfigurationPreviewIntentThumbnail")] + Thumbnail, + } } diff --git a/src/uikit.cs b/src/uikit.cs index d5e5e14d7c..6b40867049 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -54,6 +54,7 @@ using UITableViewDataSource = Foundation.NSObjectProtocol; using IUITextInput = Foundation.NSObjectProtocol; using IUICoordinateSpace = Foundation.NSObjectProtocol; +using UIActivity = Foundation.NSObject; using UICollectionViewLayout = Foundation.NSObject; using UITraitCollection = Foundation.NSObject; using UIBlurEffect = Foundation.NSObject; @@ -867,7 +868,7 @@ namespace UIKit { NSString ColumnTerminatorsAttributeName { get; } } -#if !WATCH + [Watch (6,0)] [BaseType (typeof (NSObject))] [DesignatedDefaultCtor] [iOS (6,0)] @@ -882,6 +883,7 @@ namespace UIKit { UIColor ShadowColor { get; set; } } +#if !WATCH [Model] [Protocol] [BaseType (typeof (NSObject))] @@ -8106,6 +8108,10 @@ namespace UIKit { [NullAllowed, Export ("windowScene", ArgumentSemantic.Weak)] UIWindowScene WindowScene { get; set; } + [iOS (13,0), TV (13,0)] + [NullAllowed, Export ("canResizeToFitContent")] + bool CanResizeToFitContent { get; [Bind ("setCanResizeToFitContent:")] set; } + [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); @@ -10628,6 +10634,12 @@ namespace UIKit { [iOS (9,1)] [Export ("touchesEstimatedPropertiesUpdated:")] void TouchesEstimatedPropertiesUpdated (NSSet touches); + + // from UIResponder (UIActivityItemsConfiguration) + + [NoWatch, NoTV, iOS (13, 0)] + [NullAllowed, Export ("activityItemsConfiguration", ArgumentSemantic.Strong)] + IUIActivityItemsConfigurationReading ActivityItemsConfiguration { get; set; } } [Category, BaseType (typeof (UIResponder))] @@ -10685,6 +10697,10 @@ namespace UIKit { [Export ("maximumFramesPerSecond")] nint MaximumFramesPerSecond { get; } + [iOS (13,0), TV (13,0)] + [Export ("calibratedLatency")] + double CalibratedLatency { get; } + [NoTV] [Export ("brightness")] nfloat Brightness { get; set; } @@ -15226,6 +15242,12 @@ namespace UIKit { [TV (13,0), NoWatch, iOS (13,0)] [Export ("modalInPresentation")] bool ModalInPresentation { [Bind ("isModalInPresentation")] get; set; } + + // From UIViewController (UIPerformsActions) + + [TV (13,0), NoWatch, iOS (13,0)] + [Export ("performsActionsWhilePresentingModally")] + bool PerformsActionsWhilePresentingModally { get; } } [iOS (7,0)] @@ -19878,8 +19900,8 @@ namespace UIKit { [Export ("persistentIdentifier")] string PersistentIdentifier { get; } - [NullAllowed, Export ("stateRestorationActivity")] - NSUserActivity StateRestorationActivity { get; } + [NullAllowed, Export ("stateRestorationActivity", ArgumentSemantic.Strong)] + NSUserActivity StateRestorationActivity { get; set; } [NullAllowed, Export ("userInfo", ArgumentSemantic.Copy)] NSDictionary UserInfo { get; set; } @@ -21092,6 +21114,9 @@ namespace UIKit { [Export ("traitCollection")] UITraitCollection TraitCollection { get; } + [NullAllowed, Export ("sizeRestrictions")] + UISceneSizeRestrictions SizeRestrictions { get; } + [Export ("windows")] UIWindow [] Windows { get; } @@ -21315,4 +21340,103 @@ namespace UIKit { UITableViewRowAnimation DefaultRowAnimation { get; set; } } + [Static] + [NoWatch, NoTV, iOS (13,0)] + interface UIActivityItemsConfigurationMetadataKey { + [Field ("UIActivityItemsConfigurationMetadataKeyTitle")] + NSString Title { get; } + + [Field ("UIActivityItemsConfigurationMetadataKeyMessageBody")] + NSString MessageBody { get; } + } + + delegate NSObject UIActivityItemsConfigurationMetadataProviderHandler (NSString activityItemsConfigurationMetadataKey); + delegate NSObject UIActivityItemsConfigurationPerItemMetadataProviderHandler (nint index, NSString activityItemsConfigurationMetadataKey); + delegate NSObject UIActivityItemsConfigurationPreviewProviderHandler (nint index, NSString activityItemsConfigurationPreviewIntent, CGSize suggestedSize); + + [NoWatch, NoTV, iOS (13,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface UIActivityItemsConfiguration : UIActivityItemsConfigurationReading { + + [NullAllowed, Export ("localObject", ArgumentSemantic.Strong)] + NSObject LocalObject { get; set; } + + [Export ("supportedInteractions", ArgumentSemantic.Copy)] + NSString [] WeakSupportedInteractions { get; set; } + + [Advice ("Uses 'UIActivityItemsConfigurationMetadataKey' constants in the function handler.")] + [NullAllowed, Export ("metadataProvider", ArgumentSemantic.Strong)] + UIActivityItemsConfigurationMetadataProviderHandler MetadataProvider { get; set; } + + [Advice ("Uses 'UIActivityItemsConfigurationMetadataKey' constants in the function handler.")] + [NullAllowed, Export ("perItemMetadataProvider", ArgumentSemantic.Strong)] + UIActivityItemsConfigurationPerItemMetadataProviderHandler PerItemMetadataProvider { get; set; } + + [Advice ("Uses 'UIActivityItemsConfigurationPreviewIntent' enum constants in the function handler.")] + [NullAllowed, Export ("previewProvider", ArgumentSemantic.Strong)] + UIActivityItemsConfigurationPreviewProviderHandler PreviewProvider { get; set; } + + [NullAllowed, Export ("applicationActivitiesProvider", ArgumentSemantic.Strong)] + Func ApplicationActivitiesProvider { get; set; } + + [Static] + [Export ("activityItemsConfigurationWithObjects:")] + UIActivityItemsConfiguration Create (INSItemProviderWriting [] objects); + + [Static] + [Export ("activityItemsConfigurationWithItemProviders:")] + UIActivityItemsConfiguration Create (NSItemProvider [] itemProviders); + + [Export ("initWithObjects:")] + [DesignatedInitializer] + IntPtr Constructor (INSItemProviderWriting[] objects); + + [Export ("initWithItemProviders:")] + [DesignatedInitializer] + IntPtr Constructor (NSItemProvider[] itemProviders); + } + + interface IUIActivityItemsConfigurationReading { } + + [NoWatch, NoTV, iOS (13,0)] + [Protocol] + interface UIActivityItemsConfigurationReading { + + [Abstract] + [Export ("itemProvidersForActivityItemsConfiguration", ArgumentSemantic.Copy)] + NSItemProvider [] ItemProvidersForActivityItemsConfiguration { get; } + + [Export ("activityItemsConfigurationSupportsInteraction:")] + bool GetActivityItemsConfigurationSupportsInteraction (NSString activityItemsConfigurationInteraction); + + [Export ("activityItemsConfigurationMetadataForKey:")] + [return: NullAllowed] + NSObject GetActivityItemsConfigurationMetadata (NSString activityItemsConfigurationMetadataKey); + + [Export ("activityItemsConfigurationMetadataForItemAtIndex:key:")] + [return: NullAllowed] + NSObject GetActivityItemsConfigurationMetadata (nint index, NSString activityItemsConfigurationMetadataKey); + + [Export ("activityItemsConfigurationPreviewForItemAtIndex:intent:suggestedSize:")] + [return: NullAllowed] + NSItemProvider GetActivityItemsConfigurationPreview (nint index, NSString activityItemsConfigurationPreviewIntent, CGSize suggestedSize); + + [return: NullAllowed] + [Export ("applicationActivitiesForActivityItemsConfiguration")] + UIActivity [] GetApplicationActivitiesForActivityItemsConfiguration (); + } + + [iOS (13,0), TV (13,0), NoWatch] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface UISceneSizeRestrictions { + + [Export ("minimumSize", ArgumentSemantic.Assign)] + CGSize MinimumSize { get; set; } + + [Export ("maximumSize", ArgumentSemantic.Assign)] + CGSize MaximumSize { get; set; } + } + } diff --git a/tests/xtro-sharpie/iOS-UIKit.ignore b/tests/xtro-sharpie/iOS-UIKit.ignore index 25d743a4ce..617d6915d5 100644 --- a/tests/xtro-sharpie/iOS-UIKit.ignore +++ b/tests/xtro-sharpie/iOS-UIKit.ignore @@ -76,3 +76,8 @@ !missing-enum! UIDirectionalRectEdge not bound !missing-selector! UIGestureRecognizer::initWithCoder: not bound !missing-selector! UIKeyCommand::action not bound + +## Introduced in Xcode 11 b5 but unlikely to be there at the end of beta, these usualy get replaced by NSCopying protocol +!missing-selector! UIBarAppearance::copy not bound +!missing-selector! UIBarButtonItemAppearance::copy not bound +!missing-selector! UITabBarItemAppearance::copy not bound diff --git a/tests/xtro-sharpie/iOS-UIKit.todo b/tests/xtro-sharpie/iOS-UIKit.todo index a3e22079be..e69de29bb2 100644 --- a/tests/xtro-sharpie/iOS-UIKit.todo +++ b/tests/xtro-sharpie/iOS-UIKit.todo @@ -1,40 +0,0 @@ -!missing-field! UIActivityItemsConfigurationInteractionShare not bound -!missing-field! UIActivityItemsConfigurationMetadataKeyMessageBody not bound -!missing-field! UIActivityItemsConfigurationMetadataKeyTitle not bound -!missing-field! UIActivityItemsConfigurationPreviewIntentFullSize not bound -!missing-field! UIActivityItemsConfigurationPreviewIntentThumbnail not bound -!missing-field! UIMenuToolbar not bound -!missing-protocol! UIActivityItemsConfigurationReading not bound -!missing-selector! +UIActivityItemsConfiguration::activityItemsConfigurationWithItemProviders: not bound -!missing-selector! +UIActivityItemsConfiguration::activityItemsConfigurationWithObjects: not bound -!missing-selector! UIActivityItemsConfiguration::applicationActivitiesProvider not bound -!missing-selector! UIActivityItemsConfiguration::initWithItemProviders: not bound -!missing-selector! UIActivityItemsConfiguration::initWithObjects: not bound -!missing-selector! UIActivityItemsConfiguration::localObject not bound -!missing-selector! UIActivityItemsConfiguration::metadataProvider not bound -!missing-selector! UIActivityItemsConfiguration::perItemMetadataProvider not bound -!missing-selector! UIActivityItemsConfiguration::previewProvider not bound -!missing-selector! UIActivityItemsConfiguration::setApplicationActivitiesProvider: not bound -!missing-selector! UIActivityItemsConfiguration::setLocalObject: not bound -!missing-selector! UIActivityItemsConfiguration::setMetadataProvider: not bound -!missing-selector! UIActivityItemsConfiguration::setPerItemMetadataProvider: not bound -!missing-selector! UIActivityItemsConfiguration::setPreviewProvider: not bound -!missing-selector! UIActivityItemsConfiguration::setSupportedInteractions: not bound -!missing-selector! UIActivityItemsConfiguration::supportedInteractions not bound -!missing-selector! UIBarAppearance::copy not bound -!missing-selector! UIBarButtonItemAppearance::copy not bound -!missing-selector! UIResponder::activityItemsConfiguration not bound -!missing-selector! UIResponder::setActivityItemsConfiguration: not bound -!missing-selector! UISceneSession::setStateRestorationActivity: not bound -!missing-selector! UISceneSizeRestrictions::maximumSize not bound -!missing-selector! UISceneSizeRestrictions::minimumSize not bound -!missing-selector! UISceneSizeRestrictions::setMaximumSize: not bound -!missing-selector! UISceneSizeRestrictions::setMinimumSize: not bound -!missing-selector! UIScreen::calibratedLatency not bound -!missing-selector! UITabBarItemAppearance::copy not bound -!missing-selector! UIViewController::performsActionsWhilePresentingModally not bound -!missing-selector! UIWindow::canResizeToFitContent not bound -!missing-selector! UIWindow::setCanResizeToFitContent: not bound -!missing-selector! UIWindowScene::sizeRestrictions not bound -!missing-type! UIActivityItemsConfiguration not bound -!missing-type! UISceneSizeRestrictions not bound diff --git a/tests/xtro-sharpie/tvOS-UIKit.ignore b/tests/xtro-sharpie/tvOS-UIKit.ignore index 363fcc56d7..1ab0ff5f1d 100644 --- a/tests/xtro-sharpie/tvOS-UIKit.ignore +++ b/tests/xtro-sharpie/tvOS-UIKit.ignore @@ -103,3 +103,8 @@ !missing-enum! UIDirectionalRectEdge not bound !missing-selector! UIGestureRecognizer::initWithCoder: not bound !missing-selector! UIKeyCommand::action not bound + +## Introduced in Xcode 11 b5 but unlikely to be there at the end of beta, these usualy get replaced by NSCopying protocol +!missing-selector! UIBarAppearance::copy not bound +!missing-selector! UIBarButtonItemAppearance::copy not bound +!missing-selector! UITabBarItemAppearance::copy not bound diff --git a/tests/xtro-sharpie/tvOS-UIKit.todo b/tests/xtro-sharpie/tvOS-UIKit.todo index 9bc4b7c35c..e69de29bb2 100644 --- a/tests/xtro-sharpie/tvOS-UIKit.todo +++ b/tests/xtro-sharpie/tvOS-UIKit.todo @@ -1,15 +0,0 @@ -!missing-field! UIMenuToolbar not bound -!missing-selector! UIBarAppearance::copy not bound -!missing-selector! UIBarButtonItemAppearance::copy not bound -!missing-selector! UISceneSession::setStateRestorationActivity: not bound -!missing-selector! UISceneSizeRestrictions::maximumSize not bound -!missing-selector! UISceneSizeRestrictions::minimumSize not bound -!missing-selector! UISceneSizeRestrictions::setMaximumSize: not bound -!missing-selector! UISceneSizeRestrictions::setMinimumSize: not bound -!missing-selector! UIScreen::calibratedLatency not bound -!missing-selector! UITabBarItemAppearance::copy not bound -!missing-selector! UIViewController::performsActionsWhilePresentingModally not bound -!missing-selector! UIWindow::canResizeToFitContent not bound -!missing-selector! UIWindow::setCanResizeToFitContent: not bound -!missing-selector! UIWindowScene::sizeRestrictions not bound -!missing-type! UISceneSizeRestrictions not bound diff --git a/tests/xtro-sharpie/watchOS-UIKit.todo b/tests/xtro-sharpie/watchOS-UIKit.todo index 400b9668aa..e69de29bb2 100644 --- a/tests/xtro-sharpie/watchOS-UIKit.todo +++ b/tests/xtro-sharpie/watchOS-UIKit.todo @@ -1,9 +0,0 @@ -!missing-selector! NSShadow::init not bound -!missing-selector! NSShadow::initWithCoder: not bound -!missing-selector! NSShadow::setShadowBlurRadius: not bound -!missing-selector! NSShadow::setShadowColor: not bound -!missing-selector! NSShadow::setShadowOffset: not bound -!missing-selector! NSShadow::shadowBlurRadius not bound -!missing-selector! NSShadow::shadowColor not bound -!missing-selector! NSShadow::shadowOffset not bound -!missing-type! NSShadow not bound