[ios][uikit] Fix [Model] in public API w/workarounds

This commit is contained in:
Sebastien Pouliot 2017-01-12 14:35:11 -05:00
Родитель 5195d45ecb
Коммит e238dac296
6 изменённых файлов: 53 добавлений и 6 удалений

Просмотреть файл

@ -8,6 +8,7 @@
using System; using System;
using XamCore.CoreGraphics;
namespace XamCore.UIKit { namespace XamCore.UIKit {
@ -77,5 +78,16 @@ namespace XamCore.UIKit {
{ {
} }
} }
#if !TVOS
public partial class UIPreviewInteraction {
[Obsolete ("Use overload accepting a IUICoordinateSpace")]
public virtual CGPoint GetLocationInCoordinateSpace (UICoordinateSpace coordinateSpace)
{
return GetLocationInCoordinateSpace ((IUICoordinateSpace) coordinateSpace);
}
}
#endif
#endif #endif
} }

Просмотреть файл

@ -18,7 +18,8 @@ using XamCore.Foundation;
namespace XamCore.UIKit { namespace XamCore.UIKit {
public partial class UIActionSheet : IEnumerable { public partial class UIActionSheet : IEnumerable {
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Obsolete ("Use overload with a IUIActionSheetDelegate parameter")]
public UIActionSheet (string title, UIActionSheetDelegate del, string cancelTitle, string destroy, params string [] other) public UIActionSheet (string title, UIActionSheetDelegate del, string cancelTitle, string destroy, params string [] other)
: this (title, del as IUIActionSheetDelegate, cancelTitle, destroy, other) : this (title, del as IUIActionSheetDelegate, cancelTitle, destroy, other)
{ {
@ -46,7 +47,8 @@ namespace XamCore.UIKit {
CancelButtonIndex = AddButton (cancelTitle); CancelButtonIndex = AddButton (cancelTitle);
} }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Obsolete ("Use overload with a IUIActionSheetDelegate parameter")]
public UIActionSheet (string title, UIActionSheetDelegate del) public UIActionSheet (string title, UIActionSheetDelegate del)
: this (title, del as IUIActionSheetDelegate, null, null, (string) null) : this (title, del as IUIActionSheetDelegate, null, null, (string) null)
{ {

Просмотреть файл

@ -16,7 +16,7 @@ using XamCore.Foundation;
namespace XamCore.UIKit { namespace XamCore.UIKit {
public partial class UIAlertView { public partial class UIAlertView {
public UIAlertView (string title, string message, UIAlertViewDelegate del, string cancelButtonTitle, params string [] otherButtons) public UIAlertView (string title, string message, IUIAlertViewDelegate del, string cancelButtonTitle, params string [] otherButtons)
: this (title, message, del, cancelButtonTitle, otherButtons == null || otherButtons.Length == 0 ? IntPtr.Zero : new NSString (otherButtons [0]).Handle, IntPtr.Zero, IntPtr.Zero) : this (title, message, del, cancelButtonTitle, otherButtons == null || otherButtons.Length == 0 ? IntPtr.Zero : new NSString (otherButtons [0]).Handle, IntPtr.Zero, IntPtr.Zero)
{ {
if (otherButtons == null) if (otherButtons == null)
@ -26,6 +26,12 @@ namespace XamCore.UIKit {
for (int i = 1; i < otherButtons.Length; i++) for (int i = 1; i < otherButtons.Length; i++)
AddButton (otherButtons [i]); AddButton (otherButtons [i]);
} }
[Obsolete ("Use overload with a IUIAlertViewDelegate parameter")]
public UIAlertView (string title, string message, UIAlertViewDelegate del, string cancelButtonTitle, params string [] otherButtons)
: this (title, message, (IUIAlertViewDelegate) del, cancelButtonTitle, otherButtons)
{
}
} }
} }

Просмотреть файл

@ -2065,6 +2065,8 @@ namespace XamCore.UIKit {
UIAlertAction PreferredAction { get; set; } UIAlertAction PreferredAction { get; set; }
} }
interface IUIAlertViewDelegate {}
[NoTV] [NoTV]
[BaseType (typeof (UIView), KeepRefUntil="Dismissed", Delegates=new string [] { "WeakDelegate" }, Events=new Type [] {typeof(UIAlertViewDelegate)})] [BaseType (typeof (UIView), KeepRefUntil="Dismissed", Delegates=new string [] { "WeakDelegate" }, Events=new Type [] {typeof(UIAlertViewDelegate)})]
[Availability (Deprecated = Platform.iOS_9_0, Message = "Use UIAlertController with a UIAlertControllerStyle.Alert type instead")] [Availability (Deprecated = Platform.iOS_9_0, Message = "Use UIAlertController with a UIAlertControllerStyle.Alert type instead")]
@ -2083,7 +2085,7 @@ namespace XamCore.UIKit {
// arguments (id, SEL), which means we only need 7 more. And 'mustAlsoBeNull' is that 7th argument. // arguments (id, SEL), which means we only need 7 more. And 'mustAlsoBeNull' is that 7th argument.
// So on ARM64 the 8th argument ('mustBeNull') is ignored, and iOS sees the 9th argument ('mustAlsoBeNull') as the 8th argument. // So on ARM64 the 8th argument ('mustBeNull') is ignored, and iOS sees the 9th argument ('mustAlsoBeNull') as the 8th argument.
[Availability (Deprecated=Platform.iOS_8_0, Message="Use UIAlertController instead")] [Availability (Deprecated=Platform.iOS_8_0, Message="Use UIAlertController instead")]
IntPtr Constructor ([NullAllowed] string title, [NullAllowed] string message, [NullAllowed] UIAlertViewDelegate viewDelegate, [NullAllowed] string cancelButtonTitle, IntPtr otherButtonTitles, IntPtr mustBeNull, IntPtr mustAlsoBeNull); IntPtr Constructor ([NullAllowed] string title, [NullAllowed] string message, [NullAllowed] IUIAlertViewDelegate viewDelegate, [NullAllowed] string cancelButtonTitle, IntPtr otherButtonTitles, IntPtr mustBeNull, IntPtr mustAlsoBeNull);
[Wrap ("WeakDelegate")] [Wrap ("WeakDelegate")]
[Protocolize] [Protocolize]
@ -8781,7 +8783,12 @@ namespace XamCore.UIKit {
[NullAllowed] // by default this property is null [NullAllowed] // by default this property is null
[Export ("dataSource", ArgumentSemantic.Assign)] [Export ("dataSource", ArgumentSemantic.Assign)]
#if XAMCORE_4_0
IUIPickerViewDataSource DataSource { get; set; }
#else
// should have been WeakDataSource
NSObject DataSource { get; set; } NSObject DataSource { get; set; }
#endif
[Export ("delegate", ArgumentSemantic.Assign)][NullAllowed] [Export ("delegate", ArgumentSemantic.Assign)][NullAllowed]
NSObject WeakDelegate { get; set; } NSObject WeakDelegate { get; set; }
@ -15931,7 +15938,7 @@ namespace XamCore.UIKit {
IUIPreviewInteractionDelegate Delegate { get; set; } IUIPreviewInteractionDelegate Delegate { get; set; }
[Export ("locationInCoordinateSpace:")] [Export ("locationInCoordinateSpace:")]
CGPoint GetLocationInCoordinateSpace ([NullAllowed] UICoordinateSpace coordinateSpace); CGPoint GetLocationInCoordinateSpace ([NullAllowed] IUICoordinateSpace coordinateSpace);
[Export ("cancelInteraction")] [Export ("cancelInteraction")]
void CancelInteraction (); void CancelInteraction ();

Просмотреть файл

@ -855,7 +855,7 @@ namespace Introspection {
if (t == pt) if (t == pt)
continue; continue;
if (!CheckType (pt, ref n)) if (!CheckType (pt, ref n))
ReportError ($"`{t.Name}.{m.Name}` includes a paramater of type `{pt.Name}` which is a concrete type `[Model]` and not an interface `[Protocol]`"); ReportError ($"`{t.Name}.{m.Name}` includes a parameter of type `{pt.Name}` which is a concrete type `[Model]` and not an interface `[Protocol]`");
} }
if (!m.IsConstructor) { if (!m.IsConstructor) {
var rt = (m as MethodInfo).ReturnType; var rt = (m as MethodInfo).ReturnType;

Просмотреть файл

@ -190,6 +190,26 @@ namespace Introspection {
if (t.Name == "UICollectionView") if (t.Name == "UICollectionView")
return; return;
break; break;
case "get_SearchResultsSource":
case "set_SearchResultsSource":
// UITableViewSource is our own creation and we did not make an interface out of it
if (t.Name == "UISearchDisplayController")
return;
break;
case "get_ImagePickerControllerDelegate":
case "set_ImagePickerControllerDelegate":
case "get_NavigationControllerDelegate":
case "set_NavigationControllerDelegate":
// fixed in XAMCORE_4_0 - alternative are the Weak* delegates
if (t.Name == "UIImagePickerController")
return;
break;
case "get_Model":
case "set_Model":
// UIPickerViewModel is our own creation and we did not make an interface out of it
if (t.Name == "UIPickerView")
return;
break;
} }
#endif #endif
base.CheckManagedMemberSignatures (m, t, ref n); base.CheckManagedMemberSignatures (m, t, ref n);