From 07355adc917a2811b180f3d3fafaaaef23c79301 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 14 Jun 2018 09:08:54 +0200 Subject: [PATCH 1/7] [UIKit] Update for Xcode10. --- src/UIKit/UIEnums.cs | 21 ++- src/spritekit.cs | 5 + src/uikit.cs | 181 ++++++++++++++++++++++++-- tests/xtro-sharpie/iOS-UIKit.todo | 36 ----- tests/xtro-sharpie/tvOS-UIKit.todo | 33 ----- tests/xtro-sharpie/watchOS-UIKit.todo | 3 - 6 files changed, 192 insertions(+), 87 deletions(-) delete mode 100644 tests/xtro-sharpie/iOS-UIKit.todo delete mode 100644 tests/xtro-sharpie/tvOS-UIKit.todo delete mode 100644 tests/xtro-sharpie/watchOS-UIKit.todo diff --git a/src/UIKit/UIEnums.cs b/src/UIKit/UIEnums.cs index c2978186c054..658771a42c52 100644 --- a/src/UIKit/UIEnums.cs +++ b/src/UIKit/UIEnums.cs @@ -1851,7 +1851,7 @@ public enum UITraitEnvironmentLayoutDirection : long RightToLeft = UIUserInterfaceLayoutDirection.RightToLeft } - [TV (10,0), NoWatch, NoiOS] + [TV (10,0), NoWatch, iOS (12,0)] [Native] public enum UIUserInterfaceStyle : long { @@ -2253,5 +2253,24 @@ public enum UIDocumentBrowserErrorCode : long Generic = 1, } + [iOS (12,0), TV (12,0), NoWatch] + [Native] + public enum UIGraphicsImageRendererFormatRange : long + { + Unspecified = -1, + Automatic = 0, + Extended, + Standard, + } + + [iOS (12,0), NoTV, NoWatch] + [Native] + public enum UIPrintErrorCode : long + { + ingNotAvailableError = 1, + NoContentError, + UnknownImageFormatError, + JobFailedError + } } diff --git a/src/spritekit.cs b/src/spritekit.cs index 4f33a2d4abf8..451b647692bc 100644 --- a/src/spritekit.cs +++ b/src/spritekit.cs @@ -149,8 +149,13 @@ partial interface SKNode : NSSecureCoding, NSCopying { [return: NullAllowed] SKNode Create (string filename); + // new is needed after iOS 12 due to the new UIFocustItem protocol. [Export ("frame")] +#if IOS || TVOS + new CGRect Frame { get; } +#else CGRect Frame { get; } +#endif [Export ("calculateAccumulatedFrame")] CGRect CalculateAccumulatedFrame (); diff --git a/src/uikit.cs b/src/uikit.cs index 19ce1d417717..fc34279ee3ef 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -5121,7 +5121,7 @@ interface UICollisionBehaviorDelegate { // Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: do not call -[UIDocument init] - the designated initializer is -[UIDocument initWithFileURL: [DisableDefaultCtor] [ThreadSafe] - interface UIDocument : NSFilePresenter, NSProgressReporting { + interface UIDocument : NSFilePresenter, NSProgressReporting , UIUserActivityRestoring { [Export ("localizedName", ArgumentSemantic.Copy)] string LocalizedName { get; } @@ -5235,7 +5235,7 @@ interface UIDocument : NSFilePresenter, NSProgressReporting { [iOS (8,0)] [Export ("restoreUserActivityState:")] - void RestoreUserActivityState (NSUserActivity userActivity); + new void RestoreUserActivityState (NSUserActivity userActivity); [iOS (8,0)] [Field ("NSUserActivityDocumentURLKey")] @@ -5703,8 +5703,8 @@ public enum UIFontTextStyle { [Field ("UIFontTextStyleCallout")] Callout, - [NoWatch, NoTV] - [iOS (11,0)] + [NoTV] + [iOS (11,0), Watch (5,0)] [Field ("UIFontTextStyleLargeTitle")] LargeTitle, } @@ -6133,6 +6133,10 @@ interface UIGraphicsImageRendererFormat [Export ("opaque")] bool Opaque { get; set; } + [Introduced (PlatformName.iOS, 10, 0, message: "Use the preferredRange property instead")] + [Deprecated (PlatformName.iOS, 12, 0, message: "Use the preferredRange property instead")] + [Introduced (PlatformName.TvOS, 10, 0, message: "Use the preferredRange property instead")] + [Deprecated (PlatformName.TvOS, 12, 0, message: "Use the preferredRange property instead")] [Export ("prefersExtendedRange")] bool PrefersExtendedRange { get; set; } @@ -6145,6 +6149,10 @@ interface UIGraphicsImageRendererFormat [Static] [Export ("formatForTraitCollection:")] UIGraphicsImageRendererFormat GetFormat (UITraitCollection traitCollection); + + [TV (12, 0), iOS (12, 0)] + [Export ("preferredRange", ArgumentSemantic.Assign)] + UIGraphicsImageRendererFormatRange PreferredRange { get; set; } } [iOS (10,0), TV (10,0)] @@ -6321,6 +6329,10 @@ interface UITextInputTraits { [iOS (11,0), TV (11,0)] [Export ("smartInsertDeleteType", ArgumentSemantic.Assign)] UITextSmartInsertDeleteType SmartInsertDeleteType { get; set; } + + [iOS (12, 0)] + [NullAllowed, Export ("passwordRules", ArgumentSemantic.Copy)] + UITextInputPasswordRules PasswordRules { get; set; } } interface UIKeyboardEventArgs { @@ -7987,6 +7999,10 @@ interface UILabel : UIContentSizeCategoryAdjusting { [iOS (9,0)] [Export ("allowsDefaultTighteningForTruncation")] bool AllowsDefaultTighteningForTruncation { get; set; } + + [TV (12, 0), NoWatch, NoiOS] + [Export ("enablesMarqueeWhenAncestorFocused")] + bool EnablesMarqueeWhenAncestorFocused { get; set; } } [BaseType (typeof (UIView))] @@ -9712,7 +9728,7 @@ partial interface UIReferenceLibraryViewController : NSCoding { } [BaseType (typeof (NSObject))] - interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus + interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus, UIUserActivityRestoring #if !TVOS , UIAccessibilityDragging #endif // !TVOS @@ -9864,7 +9880,7 @@ interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus [iOS (8,0)] [Export ("restoreUserActivityState:")] - void RestoreUserActivityState (NSUserActivity activity); + new void RestoreUserActivityState (NSUserActivity activity); [iOS (9,0)] [Export ("pressesBegan:withEvent:")] @@ -10024,15 +10040,15 @@ UIScreenMode CurrentMode { } [BaseType (typeof (UIView), Delegates=new string [] { "WeakDelegate" }, Events=new Type [] {typeof(UIScrollViewDelegate)})] - interface UIScrollView { + interface UIScrollView : UIFocusItemScrollableContainer { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); [Export ("contentOffset")] - CGPoint ContentOffset { get; set; } + new CGPoint ContentOffset { get; set; } [Export ("contentSize")] - CGSize ContentSize { get; set; } + new CGSize ContentSize { get; set; } [Export ("contentInset")] UIEdgeInsets ContentInset { get; set; } @@ -12886,7 +12902,7 @@ interface UIVideoEditorControllerDelegate { } [BaseType (typeof (UIResponder))] - interface UIView : UIAppearance, UIAppearanceContainer, UIAccessibility, UIDynamicItem, NSCoding, UIAccessibilityIdentification, UITraitEnvironment, UICoordinateSpace, UIFocusItem, CALayerDelegate { + interface UIView : UIAppearance, UIAppearanceContainer, UIAccessibility, UIDynamicItem, NSCoding, UIAccessibilityIdentification, UITraitEnvironment, UICoordinateSpace, UIFocusItem, CALayerDelegate, UIFocusItemContainer { [DesignatedInitializer] [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); @@ -12995,7 +13011,7 @@ interface UIView : UIAppearance, UIAppearanceContainer, UIAccessibility, UIDynam CoreAnimation.CALayer Layer { get; } [Export ("frame")] - CGRect Frame { get; set; } + new CGRect Frame { get; set; } [Export ("center")] new CGPoint Center { get; set; } @@ -14320,7 +14336,7 @@ partial interface UITraitCollection : NSCopying, NSSecureCoding { [Export ("userInterfaceIdiom")] UIUserInterfaceIdiom UserInterfaceIdiom { get; } - [TV (10, 0), NoWatch, NoiOS] + [TV (10, 0), NoWatch, iOS (12,0)] [Export ("userInterfaceStyle")] UIUserInterfaceStyle UserInterfaceStyle { get; } @@ -14355,7 +14371,7 @@ partial interface UITraitCollection : NSCopying, NSSecureCoding { [Static, Export ("traitCollectionWithForceTouchCapability:")] UITraitCollection FromForceTouchCapability (UIForceTouchCapability capability); - [TV (10, 0), NoWatch, NoiOS] + [TV (10, 0), NoWatch, iOS (12,0)] [Static] [Export ("traitCollectionWithUserInterfaceStyle:")] UITraitCollection FromUserInterfaceStyle (UIUserInterfaceStyle userInterfaceStyle); @@ -14862,6 +14878,14 @@ interface UITextContentType { [iOS (11,0), TV (11,0)] [Field ("UITextContentTypePassword")] NSString Password { get; } + + [TV (12, 0), iOS (12, 0)] + [Field ("UITextContentTypeNewPassword")] + NSString NewPassword { get; } + + [TV (12, 0), iOS (12, 0)] + [Field ("UITextContentTypeOneTimeCode")] + NSString OneTimeCode { get; } } [BaseType (typeof (UIViewController), Delegates=new string [] { "WeakDelegate" }, Events=new Type [] {typeof(UISplitViewControllerDelegate)})] @@ -16679,6 +16703,27 @@ interface UIFocusGuide { IUIFocusEnvironment[] PreferredFocusEnvironments { get; set; } } + [TV (12,0), iOS (12,0)] + [BaseType (typeof(NSObject))] + [DisableDefaultCtor] + interface UIFocusMovementHint : NSCopying + { + [Export ("movementDirection")] + CGVector MovementDirection { get; } + + [Export ("perspectiveTransform")] + CATransform3D PerspectiveTransform { get; } + + [Export ("rotation")] + CGVector Rotation { get; } + + [Export ("translation")] + CGVector Translation { get; } + + [Export ("interactionTransform")] + CATransform3D InteractionTransform { get; } + } + interface IUIFocusItem {} [iOS (10,0)] [Protocol] @@ -16687,6 +16732,15 @@ interface UIFocusItem : UIFocusEnvironment [Abstract] [Export ("canBecomeFocused")] bool CanBecomeFocused { get; } + + [TV (12, 0), iOS (12, 0), NoWatch] + [Abstract] + [Export ("frame")] + CGRect Frame { get; } + + [TV (12, 0), iOS (12, 0), NoWatch] + [Export ("didHintFocusMovement:")] + void DidHintFocusMovement (UIFocusMovementHint hint); } [DisableDefaultCtor] // [Assert] -init is not a useful initializer for this class. Use one of the designated initializers instead @@ -16747,6 +16801,24 @@ interface UIFocusSystem { // The 2 values associated with the 'UIFocusSoundIdentifier' smart enum cannot be used. // See https://developer.apple.com/documentation/uikit/uifocussystem/2887479-register // Do not specify one of the UIKit sound identifiers (such as default); doing so will cause an immediate assertion failure and crash your app. + + [TV (12, 0), iOS (12, 0)] + [NullAllowed, Export ("focusedItem", ArgumentSemantic.Weak)] + IUIFocusItem FocusedItem { get; } + + [TV (12,0), iOS (12,0)] + [Static] + [Export ("focusSystemForEnvironment:")] + [return: NullAllowed] + UIFocusSystem Create (IUIFocusEnvironment environment); + + [TV (12,0), iOS (12,0)] + [Export ("requestFocusUpdateToEnvironment:")] + void RequestFocusUpdate (IUIFocusEnvironment environment); + + [TV (12,0), iOS (12,0)] + [Export ("updateFocusIfNeeded")] + void UpdateFocusIfNeeded (); } interface IUIFocusDebuggerOutput {} @@ -16930,7 +17002,30 @@ interface UIFocusEnvironment { [Export ("soundIdentifierForFocusUpdateInContext:")] [return: NullAllowed] NSString GetSoundIdentifier (UIFocusUpdateContext context); - + + + [TV (12, 0), iOS (12, 0)] + [Abstract] + [NullAllowed, Export ("parentFocusEnvironment", ArgumentSemantic.Weak)] + IUIFocusEnvironment ParentFocusEnvironment { get; } + + [TV (12, 0), iOS (12, 0)] + [Abstract] + [NullAllowed, Export ("focusItemContainer")] + IUIFocusItemContainer FocusItemContainer { get; } + } + + [TV (12,0), iOS (12,0)] + [BaseType (typeof(NSObject))] + [DisableDefaultCtor] + interface UITextInputPasswordRules : NSSecureCoding, NSCopying + { + [Export ("passwordRulesDescriptor")] + string PasswordRulesDescriptor { get; } + + [Static] + [Export ("passwordRulesWithDescriptor:")] + UITextInputPasswordRules Create (string passwordRulesDescriptor); } #endif // !WATCH @@ -18235,6 +18330,52 @@ interface UIDocumentBrowserAction { [Export ("supportsMultipleItems")] bool SupportsMultipleItems { get; set; } } + + + interface IUIFocusItemContainer {} + [iOS (12,0), TV (12,0), NoWatch] + [Protocol] + interface UIFocusItemContainer + { + [Abstract] + [Export ("coordinateSpace")] + IUICoordinateSpace CoordinateSpace { get; } + + [Abstract] + [Export ("focusItemsInRect:")] + IUIFocusItem[] GetFocusItems (CGRect rect); + } + + [iOS (12,0), TV(12,0), NoWatch] + [Protocol] + interface UIFocusItemScrollableContainer : UIFocusItemContainer + { + [Abstract] + [TV(9,0), NoWatch] + [Export ("contentOffset", ArgumentSemantic.Assign)] + CGPoint ContentOffset { get; set; } + + [Abstract] + [TV(9,0), NoWatch] + [Export ("contentSize")] + CGSize ContentSize { get; } + + [Abstract] + [iOS (12,0), TV(12,0), NoWatch] + [Export ("visibleSize")] + CGSize VisibleSize { get; } + } + + [iOS (8,0), TV (8,0), NoWatch] // it was added on 8,0, but was not binded and the method was added in 12,0 + [Protocol] + interface UIUserActivityRestoring + { + [Abstract] + [iOS (8,0), TV(12,0)] + [Export ("restoreUserActivityState:")] + void RestoreUserActivityState (NSUserActivity userActivity); + } + #endif // !WATCH [Watch (4,0), TV (11,0), iOS (11,0)] @@ -18276,4 +18417,16 @@ interface UIFontMetrics { nfloat GetScaledValue (nfloat value, [NullAllowed] UITraitCollection traitCollection); #endif // !WATCH } + + [Static] + [iOS (12,0), TV (12,0), Watch (5,0)] + interface UIKitVersion { + + [Field ("UIKitVersionNumber")] + double UIKitVersionNumber { get; } + + [Field ("UIKitVersionString")] + NSString UIKitVersionString { get; } + + } } diff --git a/tests/xtro-sharpie/iOS-UIKit.todo b/tests/xtro-sharpie/iOS-UIKit.todo deleted file mode 100644 index 97eb67a9ea16..000000000000 --- a/tests/xtro-sharpie/iOS-UIKit.todo +++ /dev/null @@ -1,36 +0,0 @@ -!missing-enum! UIGraphicsImageRendererFormatRange not bound -!missing-enum! UIPrintErrorCode not bound -!missing-enum! UIUserInterfaceStyle not bound -!missing-field! UIKitVersionNumber not bound -!missing-field! UIKitVersionString not bound -!missing-field! UITextContentTypeNewPassword not bound -!missing-field! UITextContentTypeOneTimeCode not bound -!missing-protocol! UIFocusItemContainer not bound -!missing-protocol! UIFocusItemScrollableContainer not bound -!missing-protocol! UIUserActivityRestoring not bound -!missing-protocol-conformance! UIDocument should conform to UIUserActivityRestoring (defined in 'ActivityContinuation' category) -!missing-protocol-conformance! UIResponder should conform to UIUserActivityRestoring (defined in 'ActivityContinuation' category) -!missing-protocol-conformance! UIScrollView should conform to UIFocusItemScrollableContainer -!missing-protocol-conformance! UIView should conform to UIFocusItemContainer -!missing-protocol-member! UIFocusEnvironment::focusItemContainer not found -!missing-protocol-member! UIFocusEnvironment::parentFocusEnvironment not found -!missing-protocol-member! UIFocusItem::didHintFocusMovement: not found -!missing-protocol-member! UIFocusItem::frame not found -!missing-protocol-member! UITextInputTraits::passwordRules not found -!missing-protocol-member! UITextInputTraits::setPasswordRules: not found -!missing-selector! +UIFocusSystem::focusSystemForEnvironment: not bound -!missing-selector! +UITextInputPasswordRules::passwordRulesWithDescriptor: not bound -!missing-selector! +UITraitCollection::traitCollectionWithUserInterfaceStyle: not bound -!missing-selector! UIFocusMovementHint::interactionTransform not bound -!missing-selector! UIFocusMovementHint::movementDirection not bound -!missing-selector! UIFocusMovementHint::perspectiveTransform not bound -!missing-selector! UIFocusMovementHint::rotation not bound -!missing-selector! UIFocusMovementHint::translation not bound -!missing-selector! UIFocusSystem::focusedItem not bound -!missing-selector! UIFocusSystem::requestFocusUpdateToEnvironment: not bound -!missing-selector! UIGraphicsImageRendererFormat::preferredRange not bound -!missing-selector! UIGraphicsImageRendererFormat::setPreferredRange: not bound -!missing-selector! UITextInputPasswordRules::passwordRulesDescriptor not bound -!missing-selector! UITraitCollection::userInterfaceStyle not bound -!missing-type! UIFocusMovementHint not bound -!missing-type! UITextInputPasswordRules not bound diff --git a/tests/xtro-sharpie/tvOS-UIKit.todo b/tests/xtro-sharpie/tvOS-UIKit.todo deleted file mode 100644 index cad054a27203..000000000000 --- a/tests/xtro-sharpie/tvOS-UIKit.todo +++ /dev/null @@ -1,33 +0,0 @@ -!missing-enum! UIGraphicsImageRendererFormatRange not bound -!missing-field! UIKitVersionNumber not bound -!missing-field! UIKitVersionString not bound -!missing-field! UITextContentTypeNewPassword not bound -!missing-field! UITextContentTypeOneTimeCode not bound -!missing-protocol! UIFocusItemContainer not bound -!missing-protocol! UIFocusItemScrollableContainer not bound -!missing-protocol! UIUserActivityRestoring not bound -!missing-protocol-conformance! UIResponder should conform to UIUserActivityRestoring (defined in 'ActivityContinuation' category) -!missing-protocol-conformance! UIScrollView should conform to UIFocusItemScrollableContainer -!missing-protocol-conformance! UIView should conform to UIFocusItemContainer -!missing-protocol-member! UIFocusEnvironment::focusItemContainer not found -!missing-protocol-member! UIFocusEnvironment::parentFocusEnvironment not found -!missing-protocol-member! UIFocusItem::didHintFocusMovement: not found -!missing-protocol-member! UIFocusItem::frame not found -!missing-protocol-member! UITextInputTraits::passwordRules not found -!missing-protocol-member! UITextInputTraits::setPasswordRules: not found -!missing-selector! +UIFocusSystem::focusSystemForEnvironment: not bound -!missing-selector! +UITextInputPasswordRules::passwordRulesWithDescriptor: not bound -!missing-selector! UIFocusMovementHint::interactionTransform not bound -!missing-selector! UIFocusMovementHint::movementDirection not bound -!missing-selector! UIFocusMovementHint::perspectiveTransform not bound -!missing-selector! UIFocusMovementHint::rotation not bound -!missing-selector! UIFocusMovementHint::translation not bound -!missing-selector! UIFocusSystem::focusedItem not bound -!missing-selector! UIFocusSystem::requestFocusUpdateToEnvironment: not bound -!missing-selector! UIGraphicsImageRendererFormat::preferredRange not bound -!missing-selector! UIGraphicsImageRendererFormat::setPreferredRange: not bound -!missing-selector! UILabel::enablesMarqueeWhenAncestorFocused not bound -!missing-selector! UILabel::setEnablesMarqueeWhenAncestorFocused: not bound -!missing-selector! UITextInputPasswordRules::passwordRulesDescriptor not bound -!missing-type! UIFocusMovementHint not bound -!missing-type! UITextInputPasswordRules not bound diff --git a/tests/xtro-sharpie/watchOS-UIKit.todo b/tests/xtro-sharpie/watchOS-UIKit.todo deleted file mode 100644 index 09427e074356..000000000000 --- a/tests/xtro-sharpie/watchOS-UIKit.todo +++ /dev/null @@ -1,3 +0,0 @@ -!missing-field! UIFontTextStyleLargeTitle not bound -!missing-field! UIKitVersionNumber not bound -!missing-field! UIKitVersionString not bound From df9d8b7a9f5000f5a78ab6e24efa27d389c342eb Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 14 Jun 2018 13:41:35 +0200 Subject: [PATCH 2/7] Address reviews. --- src/UIKit/UIEnums.cs | 3 +-- src/spritekit.cs | 4 ---- src/uikit.cs | 27 +++++++++++++++------------ 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/UIKit/UIEnums.cs b/src/UIKit/UIEnums.cs index 658771a42c52..e026dfd0e684 100644 --- a/src/UIKit/UIEnums.cs +++ b/src/UIKit/UIEnums.cs @@ -2267,10 +2267,9 @@ public enum UIGraphicsImageRendererFormatRange : long [Native] public enum UIPrintErrorCode : long { - ingNotAvailableError = 1, + NotAvailableError = 1, NoContentError, UnknownImageFormatError, JobFailedError } - } diff --git a/src/spritekit.cs b/src/spritekit.cs index 451b647692bc..97ca65d26102 100644 --- a/src/spritekit.cs +++ b/src/spritekit.cs @@ -151,11 +151,7 @@ partial interface SKNode : NSSecureCoding, NSCopying { // new is needed after iOS 12 due to the new UIFocustItem protocol. [Export ("frame")] -#if IOS || TVOS - new CGRect Frame { get; } -#else CGRect Frame { get; } -#endif [Export ("calculateAccumulatedFrame")] CGRect CalculateAccumulatedFrame (); diff --git a/src/uikit.cs b/src/uikit.cs index fc34279ee3ef..ee92c3cb331b 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -5121,7 +5121,7 @@ interface UICollisionBehaviorDelegate { // Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: do not call -[UIDocument init] - the designated initializer is -[UIDocument initWithFileURL: [DisableDefaultCtor] [ThreadSafe] - interface UIDocument : NSFilePresenter, NSProgressReporting , UIUserActivityRestoring { + interface UIDocument : NSFilePresenter, NSProgressReporting, UIUserActivityRestoring { [Export ("localizedName", ArgumentSemantic.Copy)] string LocalizedName { get; } @@ -6133,10 +6133,10 @@ interface UIGraphicsImageRendererFormat [Export ("opaque")] bool Opaque { get; set; } - [Introduced (PlatformName.iOS, 10, 0, message: "Use the preferredRange property instead")] - [Deprecated (PlatformName.iOS, 12, 0, message: "Use the preferredRange property instead")] - [Introduced (PlatformName.TvOS, 10, 0, message: "Use the preferredRange property instead")] - [Deprecated (PlatformName.TvOS, 12, 0, message: "Use the preferredRange property instead")] + [Introduced (PlatformName.iOS, 10, 0, message: "Use the 'PreferredRange' property instead.")] + [Deprecated (PlatformName.iOS, 12, 0, message: "Use the 'PreferredRange' property instead.")] + [Introduced (PlatformName.TvOS, 10, 0, message: "Use the 'PreferredRange' property instead.")] + [Deprecated (PlatformName.TvOS, 12, 0, message: "Use the 'PreferredRange' property instead.")] [Export ("prefersExtendedRange")] bool PrefersExtendedRange { get; set; } @@ -8465,7 +8465,7 @@ interface UIImagePickerControllerDelegate { [BaseType (typeof (UIDocument))] // *** Assertion failure in -[UIManagedDocument init], /SourceCache/UIKit_Sim/UIKit-1914.84/UIDocument.m:258 [DisableDefaultCtor] - interface UIManagedDocument { + interface UIManagedDocument : UIManagedDocument { // note: ctor are not inherited, but this is how the documentation tells you to create an UIManagedDocument // https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIManagedDocument_Class/Reference/Reference.html [Export ("initWithFileURL:")] @@ -13011,7 +13011,7 @@ interface UIView : UIAppearance, UIAppearanceContainer, UIAccessibility, UIDynam CoreAnimation.CALayer Layer { get; } [Export ("frame")] - new CGRect Frame { get; set; } + CGRect Frame { get; set; } [Export ("center")] new CGPoint Center { get; set; } @@ -16733,10 +16733,14 @@ interface UIFocusItem : UIFocusEnvironment [Export ("canBecomeFocused")] bool CanBecomeFocused { get; } + // FIXME: declared as a @required, but this breaks compatibilit + // Radar: 41121416 +#if XAMCORE_4_0 [TV (12, 0), iOS (12, 0), NoWatch] [Abstract] [Export ("frame")] CGRect Frame { get; } +#endif [TV (12, 0), iOS (12, 0), NoWatch] [Export ("didHintFocusMovement:")] @@ -17003,7 +17007,9 @@ interface UIFocusEnvironment { [return: NullAllowed] NSString GetSoundIdentifier (UIFocusUpdateContext context); - + // FIXME: declared as a @required, but this breaks compatibility + // Radar: 41121293 +#if XAMCORE_4_0 [TV (12, 0), iOS (12, 0)] [Abstract] [NullAllowed, Export ("parentFocusEnvironment", ArgumentSemantic.Weak)] @@ -17013,6 +17019,7 @@ interface UIFocusEnvironment { [Abstract] [NullAllowed, Export ("focusItemContainer")] IUIFocusItemContainer FocusItemContainer { get; } +#endif } [TV (12,0), iOS (12,0)] @@ -18331,7 +18338,6 @@ interface UIDocumentBrowserAction { bool SupportsMultipleItems { get; set; } } - interface IUIFocusItemContainer {} [iOS (12,0), TV (12,0), NoWatch] [Protocol] @@ -18351,17 +18357,14 @@ interface UIFocusItemContainer interface UIFocusItemScrollableContainer : UIFocusItemContainer { [Abstract] - [TV(9,0), NoWatch] [Export ("contentOffset", ArgumentSemantic.Assign)] CGPoint ContentOffset { get; set; } [Abstract] - [TV(9,0), NoWatch] [Export ("contentSize")] CGSize ContentSize { get; } [Abstract] - [iOS (12,0), TV(12,0), NoWatch] [Export ("visibleSize")] CGSize VisibleSize { get; } } From 721efdc143244cfed79f1e21c531e86013c27e4d Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 14 Jun 2018 13:47:47 +0200 Subject: [PATCH 3/7] Removed not needed comment. --- src/spritekit.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/spritekit.cs b/src/spritekit.cs index 97ca65d26102..4f33a2d4abf8 100644 --- a/src/spritekit.cs +++ b/src/spritekit.cs @@ -149,7 +149,6 @@ partial interface SKNode : NSSecureCoding, NSCopying { [return: NullAllowed] SKNode Create (string filename); - // new is needed after iOS 12 due to the new UIFocustItem protocol. [Export ("frame")] CGRect Frame { get; } From a6511565131394dc8f2cd6e6533b4a89554a810c Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Thu, 14 Jun 2018 20:41:24 +0200 Subject: [PATCH 4/7] Address comments from reviews. --- src/spritekit.cs | 2 ++ src/uikit.cs | 40 ++++++------------------- tests/xtro-sharpie/iOS-UIKit.ignore | 6 ++++ tests/xtro-sharpie/tvOS-UIKit.ignore | 9 ++++++ tests/xtro-sharpie/watchOS-UIKit.ignore | 4 +++ 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/spritekit.cs b/src/spritekit.cs index 4f33a2d4abf8..be121001e160 100644 --- a/src/spritekit.cs +++ b/src/spritekit.cs @@ -149,8 +149,10 @@ partial interface SKNode : NSSecureCoding, NSCopying { [return: NullAllowed] SKNode Create (string filename); +#if MONOMAC || WATCH [Export ("frame")] CGRect Frame { get; } +#endif [Export ("calculateAccumulatedFrame")] CGRect CalculateAccumulatedFrame (); diff --git a/src/uikit.cs b/src/uikit.cs index ee92c3cb331b..e469ab21723b 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -5233,10 +5233,6 @@ interface UIDocument : NSFilePresenter, NSProgressReporting, UIUserActivityResto [Export ("updateUserActivityState:")] void UpdateUserActivityState (NSUserActivity userActivity); - [iOS (8,0)] - [Export ("restoreUserActivityState:")] - new void RestoreUserActivityState (NSUserActivity userActivity); - [iOS (8,0)] [Field ("NSUserActivityDocumentURLKey")] NSString UserActivityDocumentUrlKey { get; } @@ -6133,9 +6129,7 @@ interface UIGraphicsImageRendererFormat [Export ("opaque")] bool Opaque { get; set; } - [Introduced (PlatformName.iOS, 10, 0, message: "Use the 'PreferredRange' property instead.")] [Deprecated (PlatformName.iOS, 12, 0, message: "Use the 'PreferredRange' property instead.")] - [Introduced (PlatformName.TvOS, 10, 0, message: "Use the 'PreferredRange' property instead.")] [Deprecated (PlatformName.TvOS, 12, 0, message: "Use the 'PreferredRange' property instead.")] [Export ("prefersExtendedRange")] bool PrefersExtendedRange { get; set; } @@ -8465,7 +8459,7 @@ interface UIImagePickerControllerDelegate { [BaseType (typeof (UIDocument))] // *** Assertion failure in -[UIManagedDocument init], /SourceCache/UIKit_Sim/UIKit-1914.84/UIDocument.m:258 [DisableDefaultCtor] - interface UIManagedDocument : UIManagedDocument { + interface UIManagedDocument { // note: ctor are not inherited, but this is how the documentation tells you to create an UIManagedDocument // https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIManagedDocument_Class/Reference/Reference.html [Export ("initWithFileURL:")] @@ -9878,10 +9872,6 @@ interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus, UIUserActiv [Export ("updateUserActivityState:")] void UpdateUserActivityState (NSUserActivity activity); - [iOS (8,0)] - [Export ("restoreUserActivityState:")] - new void RestoreUserActivityState (NSUserActivity activity); - [iOS (9,0)] [Export ("pressesBegan:withEvent:")] void PressesBegan (NSSet presses, UIPressesEvent evt); @@ -10044,9 +10034,6 @@ interface UIScrollView : UIFocusItemScrollableContainer { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); - [Export ("contentOffset")] - new CGPoint ContentOffset { get; set; } - [Export ("contentSize")] new CGSize ContentSize { get; set; } @@ -13011,7 +12998,7 @@ interface UIView : UIAppearance, UIAppearanceContainer, UIAccessibility, UIDynam CoreAnimation.CALayer Layer { get; } [Export ("frame")] - CGRect Frame { get; set; } + new CGRect Frame { get; set; } [Export ("center")] new CGPoint Center { get; set; } @@ -16735,12 +16722,12 @@ interface UIFocusItem : UIFocusEnvironment // FIXME: declared as a @required, but this breaks compatibilit // Radar: 41121416 -#if XAMCORE_4_0 [TV (12, 0), iOS (12, 0), NoWatch] +#if XAMCORE_4_0 [Abstract] +#endif [Export ("frame")] CGRect Frame { get; } -#endif [TV (12, 0), iOS (12, 0), NoWatch] [Export ("didHintFocusMovement:")] @@ -17009,17 +16996,19 @@ interface UIFocusEnvironment { // FIXME: declared as a @required, but this breaks compatibility // Radar: 41121293 -#if XAMCORE_4_0 [TV (12, 0), iOS (12, 0)] +#if XAMCORE_4_0 [Abstract] +#endif [NullAllowed, Export ("parentFocusEnvironment", ArgumentSemantic.Weak)] IUIFocusEnvironment ParentFocusEnvironment { get; } [TV (12, 0), iOS (12, 0)] +#if XAMCORE_4_0 [Abstract] +#endif [NullAllowed, Export ("focusItemContainer")] IUIFocusItemContainer FocusItemContainer { get; } -#endif } [TV (12,0), iOS (12,0)] @@ -18369,7 +18358,7 @@ interface UIFocusItemScrollableContainer : UIFocusItemContainer CGSize VisibleSize { get; } } - [iOS (8,0), TV (8,0), NoWatch] // it was added on 8,0, but was not binded and the method was added in 12,0 + [iOS (8,0), NoWatch] // it was added on 8,0, but was not binded and the method was added in 12,0 [Protocol] interface UIUserActivityRestoring { @@ -18421,15 +18410,4 @@ interface UIFontMetrics { #endif // !WATCH } - [Static] - [iOS (12,0), TV (12,0), Watch (5,0)] - interface UIKitVersion { - - [Field ("UIKitVersionNumber")] - double UIKitVersionNumber { get; } - - [Field ("UIKitVersionString")] - NSString UIKitVersionString { get; } - - } } diff --git a/tests/xtro-sharpie/iOS-UIKit.ignore b/tests/xtro-sharpie/iOS-UIKit.ignore index c909dc207d6d..34e5fc534357 100644 --- a/tests/xtro-sharpie/iOS-UIKit.ignore +++ b/tests/xtro-sharpie/iOS-UIKit.ignore @@ -27,6 +27,9 @@ ## fixed for XAMCORE_4_0 !incorrect-protocol-member! UIDocumentPickerDelegate::documentPicker:didPickDocumentAtURL: is OPTIONAL and should NOT be abstract +!incorrect-protocol-member! UIFocusItem::frame is REQUIRED and should be abstract +!incorrect-protocol-member! UIFocusEnvironment::focusItemContainer is REQUIRED and should be abstract +!incorrect-protocol-member! UIFocusEnvironment::parentFocusEnvironment is REQUIRED and should be abstract ## Special case from UIAccessibilityAction. We added it (completly) on UIResponser but magic tap is also available on app delegate according to docs ## See comments is uikit.cs for more info @@ -39,6 +42,9 @@ # fixed in XAMCORE_4_0 - API break !incorrect-protocol-member! UIDocumentMenuDelegate::documentMenuWasCancelled: is OPTIONAL and should NOT be abstract +# not needed ad we do the same in other frameworks with versions. +!missing-field! UIKitVersionNumber not bound +!missing-field! UIKitVersionString not bound ## unsorted diff --git a/tests/xtro-sharpie/tvOS-UIKit.ignore b/tests/xtro-sharpie/tvOS-UIKit.ignore index ebe5122c8b8a..a13bad67a3fd 100644 --- a/tests/xtro-sharpie/tvOS-UIKit.ignore +++ b/tests/xtro-sharpie/tvOS-UIKit.ignore @@ -61,3 +61,12 @@ ## https://github.com/xamarin/xamarin-macios/issues/3213 should be fixed before conformance to 'UIStateRestoring' is restored. !missing-protocol-conformance! UIViewController should conform to UIStateRestoring (defined in 'UIStateRestoration' category) + +# not needed ad we do the same in other frameworks with versions. +!missing-field! UIKitVersionNumber not bound +!missing-field! UIKitVersionString not bound + +## fixed for XAMCORE_4_0 +!incorrect-protocol-member! UIFocusItem::frame is REQUIRED and should be abstract +!incorrect-protocol-member! UIFocusEnvironment::focusItemContainer is REQUIRED and should be abstract +!incorrect-protocol-member! UIFocusEnvironment::parentFocusEnvironment is REQUIRED and should be abstract \ No newline at end of file diff --git a/tests/xtro-sharpie/watchOS-UIKit.ignore b/tests/xtro-sharpie/watchOS-UIKit.ignore index 6e5204725d56..e9c410c1948d 100644 --- a/tests/xtro-sharpie/watchOS-UIKit.ignore +++ b/tests/xtro-sharpie/watchOS-UIKit.ignore @@ -28,3 +28,7 @@ !missing-protocol-conformance! UIColor should conform to NSItemProviderWriting (defined in 'UINSItemProvider' category) !missing-protocol-conformance! UIImage should conform to NSItemProviderReading (defined in 'NSItemProvider' category) !missing-protocol-conformance! UIImage should conform to NSItemProviderWriting (defined in 'NSItemProvider' category) + +# not needed ad we do the same in other frameworks with versions. +!missing-field! UIKitVersionNumber not bound +!missing-field! UIKitVersionString not bound \ No newline at end of file From 9464027a64894ce8d7b24c710cb68eeddeefe170 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 15 Jun 2018 07:58:38 +0200 Subject: [PATCH 5/7] Add exception for the tests after double checking the headers. --- tests/introspection/ApiProtocolTest.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/introspection/ApiProtocolTest.cs b/tests/introspection/ApiProtocolTest.cs index 8e0afd0c2a72..24e43243289e 100644 --- a/tests/introspection/ApiProtocolTest.cs +++ b/tests/introspection/ApiProtocolTest.cs @@ -198,6 +198,15 @@ protected virtual bool Skip (Type type, string protocolName) return true; } break; + case "UIUserActivityRestoring": + switch (type.Name) { + // UIKit.framework/Headers/UIDocument.h + case "UIDocument": + // inherits it from UIDocument + case "UIManagedDocument": + return true; + } + break; } return false; } From 462bdc3470dca7d7e6a60b29b4e3b6457841b667 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Mon, 18 Jun 2018 08:16:43 +0200 Subject: [PATCH 6/7] Ignore a protocol test on 32 devices. --- tests/introspection/ApiProtocolTest.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/introspection/ApiProtocolTest.cs b/tests/introspection/ApiProtocolTest.cs index 24e43243289e..ac75c7461b56 100644 --- a/tests/introspection/ApiProtocolTest.cs +++ b/tests/introspection/ApiProtocolTest.cs @@ -64,6 +64,15 @@ IntPtr GetClass (Type type) protected virtual bool Skip (Type type, string protocolName) { + // The following protocols are skipped in classic since they were added in + // later versions + if (IntPtr.Size == 4) { + switch (protocolName) { + case "UIUserActivityRestoring": + return true; + } + } + switch (protocolName) { case "NSCopying": switch (type.Name) { From b97f667e0ff75be745c86d48d489d8e01a1f37f5 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Mon, 18 Jun 2018 11:44:19 +0200 Subject: [PATCH 7/7] Update param name, fix typo. --- src/uikit.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uikit.cs b/src/uikit.cs index e469ab21723b..9db5591c740f 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -16720,7 +16720,7 @@ interface UIFocusItem : UIFocusEnvironment [Export ("canBecomeFocused")] bool CanBecomeFocused { get; } - // FIXME: declared as a @required, but this breaks compatibilit + // FIXME: declared as a @required, but this breaks compatibility // Radar: 41121416 [TV (12, 0), iOS (12, 0), NoWatch] #if XAMCORE_4_0 @@ -18365,7 +18365,7 @@ interface UIUserActivityRestoring [Abstract] [iOS (8,0), TV(12,0)] [Export ("restoreUserActivityState:")] - void RestoreUserActivityState (NSUserActivity userActivity); + void RestoreUserActivityState (NSUserActivity activity); } #endif // !WATCH