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 for Xcode10. #4253

Merged
merged 9 commits into from
Jun 18, 2018

Conversation

mandel-macaque
Copy link
Member

This is an update for the Xcode 10. I am interested in input regarding the addition of the new protocols that have been added with old methods (already present) and new ones:

  • UIUserActivityRestoring: "void RestoreUserActivityState (NSUserActivity userActivity)" was already present.
  • UIFocusItemScrollableContainer: "ContentOffset" and "ContentSize" already present.
  • UIFocusItemContainer: "Frame" already present.

I added the methods in the protocols with the correct signature, left the methods in the old interfaces and added new to ignore errors. Comments are welcome regarding this approach.

Diffs are:

[Native]
public enum UIPrintErrorCode : long
{
ingNotAvailableError = 1,
Copy link
Member

Choose a reason for hiding this comment

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

ing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ups, sorry.

src/spritekit.cs Outdated
@@ -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.
Copy link
Member

Choose a reason for hiding this comment

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

I suppose the comment should say UIFocusItem?

src/uikit.cs Outdated
@@ -16687,6 +16732,15 @@ interface UIFocusItem : UIFocusEnvironment
[Abstract]
[Export ("canBecomeFocused")]
bool CanBecomeFocused { get; }

[TV (12, 0), iOS (12, 0), NoWatch]
[Abstract]
Copy link
Member

Choose a reason for hiding this comment

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

This is a breaking change: can't add new [Abstract] members to an existing protocol.

It should go into a #if XAMCORE_4_0 block.

src/uikit.cs Outdated


[TV (12, 0), iOS (12, 0)]
[Abstract]
Copy link
Member

Choose a reason for hiding this comment

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

Breaking change.

Copy link
Member Author

Choose a reason for hiding this comment

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

So XAMCORE_4_0 then

src/uikit.cs Outdated
IUIFocusEnvironment ParentFocusEnvironment { get; }

[TV (12, 0), iOS (12, 0)]
[Abstract]
Copy link
Member

Choose a reason for hiding this comment

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

Breaking change.

src/uikit.cs Outdated
interface UIFocusItemScrollableContainer : UIFocusItemContainer
{
[Abstract]
[TV(9,0), NoWatch]
Copy link
Member

Choose a reason for hiding this comment

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

The protocol itself is TV (12,0), but there are members with TV (9,0)? That sounds strange (but otoh it wouldn't surprise me either...)

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, the protocol was added later, let me double check.

@monojenkins
Copy link
Collaborator

Build failure
Build comment file:

Provisioning succeeded
Build succeeded
API Diff (from stable)
API Diff (from PR only)
Generator Diff
🔥 Test run failed 🔥

Test results

4 tests failed, 60 tests passed.

Failed tests

  • introspection/iOS Unified 32-bits - simulator/Debug: Failed
  • introspection/iOS Unified 64-bits - simulator/Debug: Failed
  • introspection/tvOS - simulator/Debug: Failed
  • introspection/watchOS - simulator/Debug: Failed

@mandel-macaque
Copy link
Member Author

@rolfbjarne changes pushed, added the #is statements and filled the rdars that have been added in the comments and in the trello board.

@monojenkins
Copy link
Collaborator

Build failure
Build comment file:

Provisioning succeeded


src/uikit.cs Outdated

// FIXME: declared as a @required, but this breaks compatibilit
// Radar: 41121416
#if XAMCORE_4_0
Copy link
Member

Choose a reason for hiding this comment

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

Only the [Abstract] need to be in XAMCORE_4_0:

#if XAMCORE_4_0
    [Abstract]
#endif
    [TV (12, 0), iOS (12, 0), NoWatch]
    [Export ("frame")]
    CGRect Frame { get; }

src/uikit.cs Outdated
@@ -5235,7 +5235,7 @@ interface UIDocument : NSFilePresenter, NSProgressReporting {

[iOS (8,0)]
[Export ("restoreUserActivityState:")]
void RestoreUserActivityState (NSUserActivity userActivity);
new void RestoreUserActivityState (NSUserActivity userActivity);
Copy link
Member

Choose a reason for hiding this comment

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

Can you try locally to remove this method, so that we get the one from the protocol, and see what happens to the api diff? I think it won't be a breaking change, in which case it's better to remove it.

@monojenkins
Copy link
Collaborator

Build failure
Build comment file:

Provisioning succeeded
🔥 Build failed 🔥


Copy link
Contributor

@spouliot spouliot left a comment

Choose a reason for hiding this comment

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

Both intro and API Diff are reporting several issues.

src/uikit.cs Outdated
@@ -6133,6 +6133,10 @@ interface UIGraphicsImageRendererFormat
[Export ("opaque")]
bool Opaque { get; set; }

[Introduced (PlatformName.iOS, 10, 0, message: "Use the 'PreferredRange' property instead.")]
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need the Introduced here

src/uikit.cs Outdated
@@ -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.")]
Copy link
Contributor

Choose a reason for hiding this comment

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

same

src/uikit.cs Outdated
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
Copy link
Contributor

Choose a reason for hiding this comment

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

tvOS started with 9.0 so remove it's attribute (which means it's always been available)

src/uikit.cs Outdated
[Field ("UIKitVersionString")]
NSString UIKitVersionString { get; }

}
Copy link
Contributor

Choose a reason for hiding this comment

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

remove those and put them in UIKit.ignore
we're doing the same in other semi-versioned frameworks

Copy link
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

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

Looks good to me after Sebastien and Rolf comments are addressed.

src/spritekit.cs Outdated
@@ -149,8 +149,10 @@ partial interface SKNode : NSSecureCoding, NSCopying {
[return: NullAllowed]
SKNode Create (string filename);

#if MONOMAC || WATCH
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand that change. I believe this is a breaking change. Also I'm confused about a SpriteKit change in this UIKit PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it is not. In iOS and TV we have the IUIFocusItem interface that already contains the Frame property. That means that in those platforms, it can be removed.

On WatchOS and MacOS we do not have that interface, therefore the property does not get generated and you have to add it manually.

Copy link
Member Author

Choose a reason for hiding this comment

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

@VincentDondain once the build is done, take a look at the api diff and the Extrospection results both confirm my statement :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah got it, didn't realize it was in IUIFocusItem 👍

@monojenkins
Copy link
Collaborator

Build failure
Build comment file:

Build succeeded
API Diff (from stable)
API Diff (from PR only) (🔥 breaking changes 🔥)
Generator Diff (please review changes)
🔥 Test run failed 🔥

Test results

2 tests failed, 62 tests passed.

Failed tests

  • introspection/iOS Unified 32-bits - simulator/Debug: Failed
  • introspection/iOS Unified 64-bits - simulator/Debug: Failed

@monojenkins
Copy link
Collaborator

Build failure
Build comment file:

Provisioning succeeded


@monojenkins
Copy link
Collaborator

Build failure
Build comment file:

Build succeeded
API Diff (from stable)
API Diff (from PR only) (🔥 breaking changes 🔥)
Generator Diff (please review changes)
🔥 Test run failed 🔥

Test results

1 tests failed, 63 tests passed.

Failed tests

  • introspection/iOS Unified 32-bits - simulator/Debug: Failed

Copy link
Contributor

@spouliot spouliot left a comment

Choose a reason for hiding this comment

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

This looks good but please check/fix/comment on bot failures before merging.

Copy link
Contributor

@VincentDondain VincentDondain left a comment

Choose a reason for hiding this comment

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

LGTM when breaking change is addressed (:

src/uikit.cs Outdated
@@ -16687,6 +16719,19 @@ interface UIFocusItem : UIFocusEnvironment
[Abstract]
[Export ("canBecomeFocused")]
bool CanBecomeFocused { get; }

// FIXME: declared as a @required, but this breaks compatibilit
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor typo: "compatibility"

@@ -9862,10 +9872,6 @@ interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus
[Export ("updateUserActivityState:")]
void UpdateUserActivityState (NSUserActivity activity);

[iOS (8,0)]
[Export ("restoreUserActivityState:")]
void RestoreUserActivityState (NSUserActivity activity);
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah the argument here was activity and not userActivity therefore removing it and using the interface is a breaking change...

Copy link
Member

Choose a reason for hiding this comment

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

mmm, we have allowed parameter name changes in the past, but since the UIUserActivityRestoring protocol just got added lets just rename userActivity to activity to avoid the breaking change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, also, braking change is probably a too "strong" adjective. API will change, not break ;)

Doing it nevertheless

Copy link
Member

Choose a reason for hiding this comment

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

It is a breaking change because of named parameters for example if anyone is doing RestoreUserActivityState (activity: x); it would not compile anymore, but yeah not very likely

[Export ("contentSize")]
CGSize ContentSize { get; set; }
new CGSize ContentSize { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Can this be removed as well, so that we get it from UIFocusItemScrollableContainer instead, or will the api diff complain?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, in this case the protocol just exposes the get, but not the set.

@@ -12995,7 +12998,7 @@ interface UIView : UIAppearance, UIAppearanceContainer, UIAccessibility, UIDynam
CoreAnimation.CALayer Layer { get; }

[Export ("frame")]
CGRect Frame { get; set; }
new CGRect Frame { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Same: can this be removed as well, so that we get it from UIFocusItemContainer instead, or will the api diff complain?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same, protocol just exposes get, not set.

@@ -9862,10 +9872,6 @@ interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus
[Export ("updateUserActivityState:")]
void UpdateUserActivityState (NSUserActivity activity);

[iOS (8,0)]
[Export ("restoreUserActivityState:")]
void RestoreUserActivityState (NSUserActivity activity);
Copy link
Member

Choose a reason for hiding this comment

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

mmm, we have allowed parameter name changes in the past, but since the UIUserActivityRestoring protocol just got added lets just rename userActivity to activity to avoid the breaking change.

src/uikit.cs Outdated
[Abstract]
[iOS (8,0), TV(12,0)]
[Export ("restoreUserActivityState:")]
void RestoreUserActivityState (NSUserActivity userActivity);
Copy link
Member

Choose a reason for hiding this comment

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

Rename userActivity to activity to avoid a breaking change.

@monojenkins
Copy link
Collaborator

Build success
Build comment file:

Build succeeded
API Diff (from stable)
API Diff (from PR only) (🔥 breaking changes 🔥)
Generator Diff (please review changes)
Test run succeeded


@monojenkins
Copy link
Collaborator

Build success
Build comment file:

Build succeeded
API Diff (from stable)
API Diff (from PR only) (🔥 breaking changes 🔥)
Generator Diff (please review changes)
Test run succeeded


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants