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

[UIKit] Update bindings to Xcode 13 Beta 5 #12706

Merged
merged 7 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
41 changes: 40 additions & 1 deletion src/UIKit/UITypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,46 @@ public override int GetHashCode ()
public static UIFloatRange Infinite = new UIFloatRange (nfloat.NegativeInfinity, nfloat.PositiveInfinity);
}
#endif


#if IOS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Availability is missing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm Availability is there too!

#if !NET
 	[Introduced (PlatformName.iOS, 15,0)]
 #else
 	[SupportedOSPlatform ("ios15.0")]
 #endif //!NET

[StructLayout (LayoutKind.Sequential)]
public struct UIPointerAccessoryPosition {
public nfloat Offset, Angle;

public UIPointerAccessoryPosition (nfloat offset, nfloat angle)
{
Offset = offset;
Angle = angle;
}

#if !COREBUILD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are missing for these manual code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Field ("UIPointerAccessoryPositionTop")]
public static UIPointerAccessoryPosition Top => (UIPointerAccessoryPosition) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionTop"), typeof (UIPointerAccessoryPosition))!;

[Field ("UIPointerAccessoryPositionTopRight")]
public static UIPointerAccessoryPosition TopRight => (UIPointerAccessoryPosition) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionTopRight"), typeof (UIPointerAccessoryPosition))!;

[Field ("UIPointerAccessoryPositionRight")]
public static UIPointerAccessoryPosition Right => (UIPointerAccessoryPosition) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionRight"), typeof (UIPointerAccessoryPosition))!;

[Field ("UIPointerAccessoryPositionBottomRight")]
public static UIPointerAccessoryPosition BottomRight => (UIPointerAccessoryPosition) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionBottomRight"), typeof (UIPointerAccessoryPosition))!;

[Field ("UIPointerAccessoryPositionBottom")]
public static UIPointerAccessoryPosition Bottom => (UIPointerAccessoryPosition) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionBottom"), typeof (UIPointerAccessoryPosition))!;

[Field ("UIPointerAccessoryPositionBottomLeft")]
public static UIPointerAccessoryPosition BottomLeft => (UIPointerAccessoryPosition) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionBottomLeft"), typeof (UIPointerAccessoryPosition))!;

[Field ("UIPointerAccessoryPositionLeft")]
public static UIPointerAccessoryPosition Left => (UIPointerAccessoryPosition) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionLeft"), typeof (UIPointerAccessoryPosition))!;

[Field ("UIPointerAccessoryPositionTopLeft")]
public static UIPointerAccessoryPosition TopLeft => (UIPointerAccessoryPosition) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionTopLeft"), typeof (UIPointerAccessoryPosition))!;
#endif
}
#endif

#if false
[Protocol]
public interface IUITextInputTraits {
Expand Down
45 changes: 36 additions & 9 deletions src/uikit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
using UIFocusSystem = Foundation.NSObject;
#endif // WATCH

#if !IOS
using UIPointerAccessoryPosition = Foundation.NSObject;
#endif // !IOS

using System;
using System.ComponentModel;

Expand Down Expand Up @@ -3186,7 +3190,7 @@ interface UIApplicationDelegate {

[iOS (15,0), TV (15,0), Watch (8,0), MacCatalyst (15,0)]
[Export ("applicationShouldAutomaticallyLocalizeKeyCommands:")]
bool GetShouldAutomaticallyLocalizeKeyCommands (UIApplication application);
bool ShouldAutomaticallyLocalizeKeyCommands (UIApplication application);
}

[Static]
Expand Down Expand Up @@ -8274,11 +8278,11 @@ interface UIButton : UIAccessibilityContentSizeCategoryImageAdjusting
[Export ("buttonType")]
UIButtonType ButtonType { get; }

[TV (15,0), Watch (8,0), iOS (15,0), MacCatalyst (15,0)]
[TV (15,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("hovered")]
bool Hovered { [Bind ("isHovered")] get; }

[TV (15,0), Watch (8,0), iOS (15,0), MacCatalyst (15,0)]
[TV (15,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("held")]
bool Held { [Bind ("isHeld")] get; }

Expand Down Expand Up @@ -9259,7 +9263,7 @@ interface UINavigationBar : UIBarPositioning, NSCoding {
[Appearance]
[TV (15,0), iOS (15,0), MacCatalyst (15,0)]
[NullAllowed, Export ("compactScrollEdgeAppearance", ArgumentSemantic.Copy)]
UINavigationBarAppearance compactScrollEdgeAppearance { get; set; }
UINavigationBarAppearance CompactScrollEdgeAppearance { get; set; }

[iOS (7,0)]
[Appearance]
Expand Down Expand Up @@ -9417,7 +9421,7 @@ UIBarButtonItem RightBarButtonItem {

[TV (15,0), iOS (15,0), MacCatalyst (15,0)]
[NullAllowed, Export ("compactScrollEdgeAppearance", ArgumentSemantic.Copy)]
UINavigationBarAppearance compactScrollEdgeAppearance { get; set; }
UINavigationBarAppearance CompactScrollEdgeAppearance { get; set; }
}

[BaseType (typeof (UIViewController))]
Expand Down Expand Up @@ -21414,10 +21418,9 @@ interface UIPointerRegion : NSCopying {
[DisableDefaultCtor]
interface UIPointerStyle : NSCopying {

// TODO: Enable with the UIPointerAccessory bindings
// [iOS (15,0), MacCatalyst (15,0)]
// [Export ("accessories", ArgumentSemantic.Copy)]
// UIPointerAccessory [] Accessories { get; set; }
[iOS (15,0), MacCatalyst (15,0)]
[Export ("accessories", ArgumentSemantic.Copy)]
UIPointerAccessory [] Accessories { get; set; }

[Static]
[Export ("styleWithEffect:shape:")]
Expand Down Expand Up @@ -22941,6 +22944,7 @@ interface UIFocusEffect : NSCopying {

[NoWatch, NoTV, iOS (15,0), MacCatalyst (15,0)]
[BaseType (typeof (UIFocusEffect))]
[DisableDefaultCtor]
interface UIFocusHaloEffect {
spouliot marked this conversation as resolved.
Show resolved Hide resolved

[Static]
Expand Down Expand Up @@ -23119,4 +23123,27 @@ interface UIWindowSceneActivationRequestOptions {
UIWindowScenePresentationStyle PreferredPresentationStyle { get; set; }
}

[NoWatch, NoTV, iOS (15,0), MacCatalyst (15,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface UIPointerAccessory : NSCopying {

[Export ("shape", ArgumentSemantic.Copy)]
UIPointerShape Shape { get; }

[Export ("position")]
UIPointerAccessoryPosition Position { get; }

[Export ("orientationMatchesAngle")]
bool OrientationMatchesAngle { get; set; }

[Static]
[Export ("accessoryWithShape:position:")]
UIPointerAccessory Create (UIPointerShape shape, UIPointerAccessoryPosition position);

[Static]
[Export ("arrowAccessoryWithPosition:")]
UIPointerAccessory CreateArrow (UIPointerAccessoryPosition position);
}

}
110 changes: 110 additions & 0 deletions tests/monotouch-test/UIKit/UIPointerAccessory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
//
// Unit tests for UIPointerAccessory
//
// Authors:
// Alex Soto <alexsoto@microsoft.com>
//
//
// Copyright Microsoft Corporation.
//

#if __IOS__
using System;
using NUnit.Framework;
using Foundation;
using UIKit;
using ObjCRuntime;

namespace MonoTouchFixtures.UIKit {
[TestFixture]
[Preserve (AllMembers = true)]
public class UIPointerAccessoryTest {

[SetUp]
public void Setup ()
{
TestRuntime.AssertXcodeVersion (13, 0);
}

[Test]
public void UIPointerAccessoryPositionTopTest ()
{
UIPointerAccessory acc = null;
Assert.DoesNotThrow (() => acc = UIPointerAccessory.CreateArrow (UIPointerAccessoryPosition.Top), "Should not throw");
Assert.NotNull (acc, $"{nameof (acc)} was null");
Assert.AreEqual (acc.Position.Offset, UIPointerAccessoryPosition.Top.Offset, "Offset");
Assert.AreEqual (acc.Position.Angle, UIPointerAccessoryPosition.Top.Angle, "Offset");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: "Angle"

}

[Test]
public void UIPointerAccessoryPositionTopRightTest ()
{
UIPointerAccessory acc = null;
Assert.DoesNotThrow (() => acc = UIPointerAccessory.CreateArrow (UIPointerAccessoryPosition.TopRight), "Should not throw");
Assert.NotNull (acc, $"{nameof (acc)} was null");
Assert.AreEqual (acc.Position.Offset, UIPointerAccessoryPosition.TopRight.Offset, "Offset");
Assert.AreEqual (acc.Position.Angle, UIPointerAccessoryPosition.TopRight.Angle, "Offset");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: "Angle"

}

[Test]
public void UIPointerAccessoryPositionRightTest ()
{
UIPointerAccessory acc = null;
Assert.DoesNotThrow (() => acc = UIPointerAccessory.CreateArrow (UIPointerAccessoryPosition.Right), "Should not throw");
Assert.NotNull (acc, $"{nameof (acc)} was null");
Assert.AreEqual (acc.Position.Offset, UIPointerAccessoryPosition.Right.Offset, "Offset");
Assert.AreEqual (acc.Position.Angle, UIPointerAccessoryPosition.Right.Angle, "Offset");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: "Angle"

}

[Test]
public void UIPointerAccessoryPositionBottomRightTest ()
{
UIPointerAccessory acc = null;
Assert.DoesNotThrow (() => acc = UIPointerAccessory.CreateArrow (UIPointerAccessoryPosition.BottomRight), "Should not throw");
Assert.NotNull (acc, $"{nameof (acc)} was null");
Assert.AreEqual (acc.Position.Offset, UIPointerAccessoryPosition.BottomRight.Offset, "Offset");
Assert.AreEqual (acc.Position.Angle, UIPointerAccessoryPosition.BottomRight.Angle, "Offset");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: "Angle"

}

[Test]
public void UIPointerAccessoryPositionBottomTest ()
{
UIPointerAccessory acc = null;
Assert.DoesNotThrow (() => acc = UIPointerAccessory.CreateArrow (UIPointerAccessoryPosition.Bottom), "Should not throw");
Assert.NotNull (acc, $"{nameof (acc)} was null");
Assert.AreEqual (acc.Position.Offset, UIPointerAccessoryPosition.Bottom.Offset, "Offset");
Assert.AreEqual (acc.Position.Angle, UIPointerAccessoryPosition.Bottom.Angle, "Offset");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: "Angle"

}

[Test]
public void UIPointerAccessoryPositionBottomLeftTest ()
{
UIPointerAccessory acc = null;
Assert.DoesNotThrow (() => acc = UIPointerAccessory.CreateArrow (UIPointerAccessoryPosition.BottomLeft), "Should not throw");
Assert.NotNull (acc, $"{nameof (acc)} was null");
Assert.AreEqual (acc.Position.Offset, UIPointerAccessoryPosition.BottomLeft.Offset, "Offset");
Assert.AreEqual (acc.Position.Angle, UIPointerAccessoryPosition.BottomLeft.Angle, "Offset");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: "Angle"

}

[Test]
public void UIPointerAccessoryPositionLeftTest ()
{
UIPointerAccessory acc = null;
Assert.DoesNotThrow (() => acc = UIPointerAccessory.CreateArrow (UIPointerAccessoryPosition.Left), "Should not throw");
Assert.NotNull (acc, $"{nameof (acc)} was null");
Assert.AreEqual (acc.Position.Offset, UIPointerAccessoryPosition.Left.Offset, "Offset");
Assert.AreEqual (acc.Position.Angle, UIPointerAccessoryPosition.Left.Angle, "Offset");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: "Angle"

}

[Test]
public void UIPointerAccessoryPositionTopLeftTest ()
{
UIPointerAccessory acc = null;
Assert.DoesNotThrow (() => acc = UIPointerAccessory.CreateArrow (UIPointerAccessoryPosition.TopLeft), "Should not throw");
Assert.NotNull (acc, $"{nameof (acc)} was null");
Assert.AreEqual (acc.Position.Offset, UIPointerAccessoryPosition.TopLeft.Offset, "Offset");
Assert.AreEqual (acc.Position.Angle, UIPointerAccessoryPosition.TopLeft.Angle, "Offset");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: "Angle"

}
}
}
#endif // __IOS__
17 changes: 0 additions & 17 deletions tests/xtro-sharpie/MacCatalyst-UIKit.todo
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@
!missing-field! NSToolbarSupplementarySidebarTrackingSeparatorItemIdentifier not bound
!missing-field! UIApplicationInvalidInterfaceOrientationException not bound
!missing-field! UIKeyInputF1 not bound
!missing-field! UIPointerAccessoryPositionBottom not bound
!missing-field! UIPointerAccessoryPositionBottomLeft not bound
!missing-field! UIPointerAccessoryPositionBottomRight not bound
!missing-field! UIPointerAccessoryPositionLeft not bound
!missing-field! UIPointerAccessoryPositionRight not bound
!missing-field! UIPointerAccessoryPositionTop not bound
!missing-field! UIPointerAccessoryPositionTopLeft not bound
!missing-field! UIPointerAccessoryPositionTopRight not bound
!missing-null-allowed! 'CoreAnimation.CADisplayLink UIKit.UIScreen::CreateDisplayLink(Foundation.NSObject,ObjCRuntime.Selector)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSArray Foundation.NSBundle::LoadNib(System.String,Foundation.NSObject,Foundation.NSDictionary)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSArray[] UIKit.UIPasteboard::PasteBoardTypesForSet(Foundation.NSIndexSet)' is missing an [NullAllowed] on parameter #0
Expand Down Expand Up @@ -444,8 +436,6 @@
!missing-requires-super! UIControl::contextMenuInteraction:willDisplayMenuForConfiguration:animator: is missing an [RequiresSuper] attribute
!missing-requires-super! UIControl::contextMenuInteraction:willEndForConfiguration:animator: is missing an [RequiresSuper] attribute
!missing-selector! +NSToolbarItem::itemWithItemIdentifier:barButtonItem: not bound
!missing-selector! +UIPointerAccessory::accessoryWithShape:position: not bound
!missing-selector! +UIPointerAccessory::arrowAccessoryWithPosition: not bound
!missing-selector! NSDiffableDataSourceSectionTransaction::difference not bound
!missing-selector! NSDiffableDataSourceTransaction::difference not bound
!missing-selector! NSMenuToolbarItem::itemMenu not bound
Expand Down Expand Up @@ -481,12 +471,6 @@
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::willExpandItemHandler not bound
!missing-selector! UIGestureRecognizer::initWithCoder: not bound
!missing-selector! UIKeyCommand::action not bound
!missing-selector! UIPointerAccessory::orientationMatchesAngle not bound
!missing-selector! UIPointerAccessory::position not bound
!missing-selector! UIPointerAccessory::setOrientationMatchesAngle: not bound
!missing-selector! UIPointerAccessory::shape not bound
!missing-selector! UIPointerStyle::accessories not bound
!missing-selector! UIPointerStyle::setAccessories: not bound
!missing-selector! UIPrintPaper::printRect not bound
!missing-selector! UIRefreshControl::setTintColor: not bound
!missing-selector! UIRefreshControl::tintColor not bound
Expand All @@ -511,6 +495,5 @@
!missing-selector! UIViewController::childViewControllerForTouchBar not bound
!missing-selector! UIViewController::setNeedsTouchBarUpdate not bound
!missing-selector! UIWindowScene::titlebar not bound
!missing-type! UIPointerAccessory not bound
!missing-type! UITitlebar not bound
## appended from unclassified file
17 changes: 0 additions & 17 deletions tests/xtro-sharpie/iOS-UIKit.todo
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
!missing-field! UIPointerAccessoryPositionBottom not bound
!missing-field! UIPointerAccessoryPositionBottomLeft not bound
!missing-field! UIPointerAccessoryPositionBottomRight not bound
!missing-field! UIPointerAccessoryPositionLeft not bound
!missing-field! UIPointerAccessoryPositionRight not bound
!missing-field! UIPointerAccessoryPositionTop not bound
!missing-field! UIPointerAccessoryPositionTopLeft not bound
!missing-field! UIPointerAccessoryPositionTopRight not bound
!missing-protocol-conformance! UIResponder should conform to UIActivityItemsConfigurationProviding (defined in 'UIActivityItemsConfiguration' category)
!missing-selector! +UIPointerAccessory::accessoryWithShape:position: not bound
!missing-selector! +UIPointerAccessory::arrowAccessoryWithPosition: not bound
!missing-selector! NSDiffableDataSourceSectionTransaction::difference not bound
!missing-selector! NSDiffableDataSourceTransaction::difference not bound
!missing-selector! UICollectionViewDiffableDataSourceReorderingHandlers::canReorderItemHandler not bound
Expand All @@ -27,10 +17,3 @@
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::snapshotForExpandingParentItemHandler not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::willCollapseItemHandler not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::willExpandItemHandler not bound
!missing-selector! UIPointerAccessory::orientationMatchesAngle not bound
!missing-selector! UIPointerAccessory::position not bound
!missing-selector! UIPointerAccessory::setOrientationMatchesAngle: not bound
!missing-selector! UIPointerAccessory::shape not bound
!missing-selector! UIPointerStyle::accessories not bound
!missing-selector! UIPointerStyle::setAccessories: not bound
!missing-type! UIPointerAccessory not bound