Skip to content

Commit

Permalink
[UIKit] Update for Xcode10. (#4253)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandel-macaque authored Jun 18, 2018
1 parent 2aaee04 commit 553238a
Show file tree
Hide file tree
Showing 10 changed files with 215 additions and 96 deletions.
22 changes: 20 additions & 2 deletions src/UIKit/UIEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -2253,5 +2253,23 @@ 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
{
NotAvailableError = 1,
NoContentError,
UnknownImageFormatError,
JobFailedError
}
}
2 changes: 2 additions & 0 deletions src/spritekit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ partial interface SKNode : NSSecureCoding, NSCopying {
[return: NullAllowed]
SKNode Create (string filename, IntPtr classesPtr, out NSError error);

#if MONOMAC || WATCH
[Export ("frame")]
CGRect Frame { get; }
#endif

[Export ("calculateAccumulatedFrame")]
CGRect CalculateAccumulatedFrame ();
Expand Down
178 changes: 156 additions & 22 deletions src/uikit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down Expand Up @@ -5233,10 +5233,6 @@ interface UIDocument : NSFilePresenter, NSProgressReporting {
[Export ("updateUserActivityState:")]
void UpdateUserActivityState (NSUserActivity userActivity);

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

[iOS (8,0)]
[Field ("NSUserActivityDocumentURLKey")]
NSString UserActivityDocumentUrlKey { get; }
Expand Down Expand Up @@ -5703,8 +5699,8 @@ public enum UIFontTextStyle {
[Field ("UIFontTextStyleCallout")]
Callout,

[NoWatch, NoTV]
[iOS (11,0)]
[NoTV]
[iOS (11,0), Watch (5,0)]
[Field ("UIFontTextStyleLargeTitle")]
LargeTitle,
}
Expand Down Expand Up @@ -6133,6 +6129,8 @@ interface UIGraphicsImageRendererFormat
[Export ("opaque")]
bool Opaque { get; set; }

[Deprecated (PlatformName.iOS, 12, 0, message: "Use the 'PreferredRange' property instead.")]
[Deprecated (PlatformName.TvOS, 12, 0, message: "Use the 'PreferredRange' property instead.")]
[Export ("prefersExtendedRange")]
bool PrefersExtendedRange { get; set; }

Expand All @@ -6145,6 +6143,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)]
Expand Down Expand Up @@ -6321,6 +6323,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 {
Expand Down Expand Up @@ -7987,6 +7993,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))]
Expand Down Expand Up @@ -9712,7 +9722,7 @@ partial interface UIReferenceLibraryViewController : NSCoding {
}

[BaseType (typeof (NSObject))]
interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus
interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus, UIUserActivityRestoring
#if !TVOS
, UIAccessibilityDragging
#endif // !TVOS
Expand Down Expand Up @@ -9862,10 +9872,6 @@ interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus
[Export ("updateUserActivityState:")]
void UpdateUserActivityState (NSUserActivity activity);

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

[iOS (9,0)]
[Export ("pressesBegan:withEvent:")]
void PressesBegan (NSSet<UIPress> presses, UIPressesEvent evt);
Expand Down Expand Up @@ -10024,15 +10030,12 @@ 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; }

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

[Export ("contentInset")]
UIEdgeInsets ContentInset { get; set; }
Expand Down Expand Up @@ -12886,7 +12889,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);
Expand Down Expand Up @@ -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; }

[Export ("center")]
new CGPoint Center { get; set; }
Expand Down Expand Up @@ -14320,7 +14323,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; }

Expand Down Expand Up @@ -14355,7 +14358,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);
Expand Down Expand Up @@ -14862,6 +14865,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)})]
Expand Down Expand Up @@ -16679,6 +16690,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]
Expand All @@ -16687,6 +16719,19 @@ interface UIFocusItem : UIFocusEnvironment
[Abstract]
[Export ("canBecomeFocused")]
bool CanBecomeFocused { get; }

// FIXME: declared as a @required, but this breaks compatibility
// Radar: 41121416
[TV (12, 0), iOS (12, 0), NoWatch]
#if XAMCORE_4_0
[Abstract]
#endif
[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
Expand Down Expand Up @@ -16747,6 +16792,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 {}
Expand Down Expand Up @@ -16930,7 +16993,35 @@ interface UIFocusEnvironment {
[Export ("soundIdentifierForFocusUpdateInContext:")]
[return: NullAllowed]
NSString GetSoundIdentifier (UIFocusUpdateContext context);


// FIXME: declared as a @required, but this breaks compatibility
// Radar: 41121293
[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; }
}

[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

Expand Down Expand Up @@ -18235,6 +18326,48 @@ 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]
[Export ("contentOffset", ArgumentSemantic.Assign)]
CGPoint ContentOffset { get; set; }

[Abstract]
[Export ("contentSize")]
CGSize ContentSize { get; }

[Abstract]
[Export ("visibleSize")]
CGSize VisibleSize { get; }
}

[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
{
[Abstract]
[iOS (8,0), TV(12,0)]
[Export ("restoreUserActivityState:")]
void RestoreUserActivityState (NSUserActivity activity);
}

#endif // !WATCH

[Watch (4,0), TV (11,0), iOS (11,0)]
Expand Down Expand Up @@ -18276,4 +18409,5 @@ interface UIFontMetrics {
nfloat GetScaledValue (nfloat value, [NullAllowed] UITraitCollection traitCollection);
#endif // !WATCH
}

}
Loading

1 comment on commit 553238a

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Jenkins job (on internal Jenkins) succeeded

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

Please sign in to comment.