[tests][intro] Detect cases where [Unavailable] is mis-used (#9871)

For each platform the presence of `[Unavailable]` should mean there are
no other availability (introduced, deprecated or obsoleted) attributes
on the same member.

Also check if the type is unavailable. In that case no member should,
for that platform, have other availability attributes.

Also fix failures - all in WatchKit which was removed from iOS.
This commit is contained in:
Sebastien Pouliot 2020-10-15 08:57:47 -04:00 коммит произвёл GitHub
Родитель e92809f38c
Коммит 3090eca84d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
23 изменённых файлов: 113 добавлений и 125 удалений

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

@ -5,7 +5,7 @@ using System.ComponentModel;
using ObjCRuntime; using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -8,7 +8,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKAccessibilityImageRegion", SkipRegistration = true)] [Register ("WKAccessibilityImageRegion", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -6,7 +6,6 @@ using Foundation;
using ObjCRuntime; using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceButton", SkipRegistration = true)] [Register ("WKInterfaceButton", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -10,7 +10,6 @@ using UIKit;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceController", SkipRegistration = true)] [Register ("WKInterfaceController", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceDate", SkipRegistration = true)] [Register ("WKInterfaceDate", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -10,7 +10,6 @@ using UIKit;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceDevice", SkipRegistration = true)] [Register ("WKInterfaceDevice", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceGroup", SkipRegistration = true)] [Register ("WKInterfaceGroup", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceImage", SkipRegistration = true)] [Register ("WKInterfaceImage", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceLabel", SkipRegistration = true)] [Register ("WKInterfaceLabel", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -8,7 +8,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceMap", SkipRegistration = true)] [Register ("WKInterfaceMap", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -9,7 +9,6 @@ using UIKit;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceObject", SkipRegistration = true)] [Register ("WKInterfaceObject", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceSeparator", SkipRegistration = true)] [Register ("WKInterfaceSeparator", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceSlider", SkipRegistration = true)] [Register ("WKInterfaceSlider", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceSwitch", SkipRegistration = true)] [Register ("WKInterfaceSwitch", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceTable", SkipRegistration = true)] [Register ("WKInterfaceTable", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKInterfaceTimer", SkipRegistration = true)] [Register ("WKInterfaceTimer", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -5,7 +5,6 @@ using System.ComponentModel;
using ObjCRuntime; using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -5,7 +5,6 @@ using System.ComponentModel;
using ObjCRuntime; using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -7,7 +7,6 @@ using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Register ("WKUserNotificationInterfaceController", SkipRegistration = true)] [Register ("WKUserNotificationInterfaceController", SkipRegistration = true)]
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -5,7 +5,7 @@ using System.ComponentModel;
using ObjCRuntime; using ObjCRuntime;
namespace WatchKit { namespace WatchKit {
[Introduced (PlatformName.iOS, 8,2, PlatformArchitecture.All)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)] [Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete (Constants.WatchKitRemoved)] [Obsolete (Constants.WatchKitRemoved)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]

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

@ -26,7 +26,6 @@ using System;
using System.ComponentModel; using System.ComponentModel;
namespace WatchKit { namespace WatchKit {
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[BaseType (typeof (NSObject))] [BaseType (typeof (NSObject))]
[Abstract] // <quote>To use this class, subclass it</quote> [Abstract] // <quote>To use this class, subclass it</quote>
@ -51,28 +50,23 @@ namespace WatchKit {
[Export ("didDeactivate")] [Export ("didDeactivate")]
void DidDeactivate (); void DidDeactivate ();
#if WATCH
[Export ("didAppear")] [Export ("didAppear")]
void DidAppear (); void DidAppear ();
[Export ("willDisappear")] [Export ("willDisappear")]
void WillDisappear (); void WillDisappear ();
#endif
[Export ("table:didSelectRowAtIndex:")] [Export ("table:didSelectRowAtIndex:")]
void DidSelectRow (WKInterfaceTable table, nint rowIndex); void DidSelectRow (WKInterfaceTable table, nint rowIndex);
[Deprecated (PlatformName.iOS, 10,0, message: "Use 'UNUserNotificationCenterDelegate' instead.")]
[Deprecated (PlatformName.WatchOS, 3,0, message: "Use 'UNUserNotificationCenterDelegate' instead.")] [Deprecated (PlatformName.WatchOS, 3,0, message: "Use 'UNUserNotificationCenterDelegate' instead.")]
[Export ("handleActionWithIdentifier:forRemoteNotification:")] [Export ("handleActionWithIdentifier:forRemoteNotification:")]
void HandleRemoteNotificationAction ([NullAllowed] string identifier, NSDictionary remoteNotification); void HandleRemoteNotificationAction ([NullAllowed] string identifier, NSDictionary remoteNotification);
[Deprecated (PlatformName.iOS, 10,0, message: "Use 'UNUserNotificationCenterDelegate' instead.")]
[Deprecated (PlatformName.WatchOS, 3,0, message: "Use 'UNUserNotificationCenterDelegate' instead.")] [Deprecated (PlatformName.WatchOS, 3,0, message: "Use 'UNUserNotificationCenterDelegate' instead.")]
[Export ("handleActionWithIdentifier:forLocalNotification:")] [Export ("handleActionWithIdentifier:forLocalNotification:")]
void HandleLocalNotificationAction ([NullAllowed] string identifier, UILocalNotification localNotification); void HandleLocalNotificationAction ([NullAllowed] string identifier, UILocalNotification localNotification);
[iOS (10,0)]
[NoWatch] [NoWatch]
[Export ("handleActionWithIdentifier:forNotification:")] [Export ("handleActionWithIdentifier:forNotification:")]
void HandleAction ([NullAllowed] string identifier, UNNotification notification); void HandleAction ([NullAllowed] string identifier, UNNotification notification);
@ -156,7 +150,7 @@ namespace WatchKit {
// This NSDictionary is OK, it is arbitrary and user specific // This NSDictionary is OK, it is arbitrary and user specific
void UpdateUserActivity (string type, [NullAllowed] NSDictionary userInfo, [NullAllowed] NSUrl webpageURL); void UpdateUserActivity (string type, [NullAllowed] NSDictionary userInfo, [NullAllowed] NSUrl webpageURL);
[Watch (5,0)][ NoiOS] [Watch (5,0)]
[Export ("updateUserActivity:")] [Export ("updateUserActivity:")]
void UpdateUserActivity (NSUserActivity userActivity); void UpdateUserActivity (NSUserActivity userActivity);
@ -168,7 +162,6 @@ namespace WatchKit {
[Async] [Async]
void PresentTextInputController ([NullAllowed] string [] suggestions, WKTextInputMode inputMode, Action<NSArray> completion); void PresentTextInputController ([NullAllowed] string [] suggestions, WKTextInputMode inputMode, Action<NSArray> completion);
[iOS (9,0)]
[Export ("presentTextInputControllerWithSuggestionsForLanguage:allowedInputMode:completion:")] [Export ("presentTextInputControllerWithSuggestionsForLanguage:allowedInputMode:completion:")]
[Async] [Async]
void PresentTextInputController ([NullAllowed] Func<NSString, NSArray> suggestionsHandler, WKTextInputMode inputMode, Action<NSArray> completion); void PresentTextInputController ([NullAllowed] Func<NSString, NSArray> suggestionsHandler, WKTextInputMode inputMode, Action<NSArray> completion);
@ -181,7 +174,7 @@ namespace WatchKit {
[Static, Export ("reloadRootControllersWithNames:contexts:")] [Static, Export ("reloadRootControllersWithNames:contexts:")]
void ReloadRootControllers (string [] names, [NullAllowed] NSObject [] contexts); void ReloadRootControllers (string [] names, [NullAllowed] NSObject [] contexts);
[Watch (4,0)][NoiOS] [Watch (4,0)]
[Static] [Static]
[Export ("reloadRootPageControllersWithNames:contexts:orientation:pageIndex:")] [Export ("reloadRootPageControllersWithNames:contexts:orientation:pageIndex:")]
void ReloadRootPageControllers (string[] names, [NullAllowed] NSObject[] contexts, WKPageOrientation orientation, nint pageIndex); void ReloadRootPageControllers (string[] names, [NullAllowed] NSObject[] contexts, WKPageOrientation orientation, nint pageIndex);
@ -192,7 +185,6 @@ namespace WatchKit {
NSString ErrorDomain { get; } NSString ErrorDomain { get; }
#endif #endif
#if WATCH
[Export ("dismissMediaPlayerController")] [Export ("dismissMediaPlayerController")]
void DismissMediaPlayerController (); void DismissMediaPlayerController ();
@ -235,46 +227,45 @@ namespace WatchKit {
[Export ("pickerDidSettle:")] [Export ("pickerDidSettle:")]
void PickerDidSettle (WKInterfacePicker picker); void PickerDidSettle (WKInterfacePicker picker);
[NoiOS] #if WATCH
[Export ("presentMediaPlayerControllerWithURL:options:completion:")] [Export ("presentMediaPlayerControllerWithURL:options:completion:")]
[Async (ResultType = typeof (WKPresentMediaPlayerResult))] [Async (ResultType = typeof (WKPresentMediaPlayerResult))]
void PresentMediaPlayerController (NSUrl url, [NullAllowed] NSDictionary options, Action<bool, double, NSError> completion); void PresentMediaPlayerController (NSUrl url, [NullAllowed] NSDictionary options, Action<bool, double, NSError> completion);
#endif #endif
[Watch (3,0)][NoiOS] [Watch (3,0)]
[Export ("crownSequencer", ArgumentSemantic.Strong)] [Export ("crownSequencer", ArgumentSemantic.Strong)]
WKCrownSequencer CrownSequencer { get; } WKCrownSequencer CrownSequencer { get; }
[Watch (4,0)][NoiOS] [Watch (4,0)]
[Export ("scrollToObject:atScrollPosition:animated:")] [Export ("scrollToObject:atScrollPosition:animated:")]
void ScrollTo (WKInterfaceObject @object, WKInterfaceScrollPosition scrollPosition, bool animated); void ScrollTo (WKInterfaceObject @object, WKInterfaceScrollPosition scrollPosition, bool animated);
[Watch (4,0)][NoiOS] [Watch (4,0)]
[Export ("interfaceDidScrollToTop")] [Export ("interfaceDidScrollToTop")]
void InterfaceDidScrollToTop (); void InterfaceDidScrollToTop ();
[Watch (4,0)][NoiOS] [Watch (4,0)]
[Export ("interfaceOffsetDidScrollToTop")] [Export ("interfaceOffsetDidScrollToTop")]
void InterfaceOffsetDidScrollToTop (); void InterfaceOffsetDidScrollToTop ();
[Watch (4,0)][NoiOS] [Watch (4,0)]
[Export ("interfaceOffsetDidScrollToBottom")] [Export ("interfaceOffsetDidScrollToBottom")]
void InterfaceOffsetDidScrollToBottom (); void InterfaceOffsetDidScrollToBottom ();
[Watch (5,0), NoiOS] [Watch (5,0)]
[Export ("contentSafeAreaInsets")] [Export ("contentSafeAreaInsets")]
UIEdgeInsets ContentSafeAreaInsets { get; } UIEdgeInsets ContentSafeAreaInsets { get; }
[Watch (5,0), NoiOS] [Watch (5,0)]
[Export ("systemMinimumLayoutMargins")] [Export ("systemMinimumLayoutMargins")]
NSDirectionalEdgeInsets SystemMinimumLayoutMargins { get; } NSDirectionalEdgeInsets SystemMinimumLayoutMargins { get; }
[Watch (5,0), NoiOS] [Watch (5,0)]
[Export ("tableScrollingHapticFeedbackEnabled")] [Export ("tableScrollingHapticFeedbackEnabled")]
bool TableScrollingHapticFeedbackEnabled { [Bind ("isTableScrollingHapticFeedbackEnabled")] get; set; } bool TableScrollingHapticFeedbackEnabled { [Bind ("isTableScrollingHapticFeedbackEnabled")] get; set; }
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[BaseType (typeof (WKInterfaceController))] [BaseType (typeof (WKInterfaceController))]
[DisableDefaultCtor] // DesignatedInitializer below [DisableDefaultCtor] // DesignatedInitializer below
@ -284,48 +275,44 @@ namespace WatchKit {
[Export ("init")] [Export ("init")]
IntPtr Constructor (); IntPtr Constructor ();
[Deprecated (PlatformName.iOS, 10,0, message: "Use 'DidReceiveNotification' instead.")]
[Deprecated (PlatformName.WatchOS, 3,0, message: "Use 'DidReceiveNotification' instead.")] [Deprecated (PlatformName.WatchOS, 3,0, message: "Use 'DidReceiveNotification' instead.")]
[Export ("didReceiveRemoteNotification:withCompletion:")] [Export ("didReceiveRemoteNotification:withCompletion:")]
void DidReceiveRemoteNotification (NSDictionary remoteNotification, Action<WKUserNotificationInterfaceType> completionHandler); void DidReceiveRemoteNotification (NSDictionary remoteNotification, Action<WKUserNotificationInterfaceType> completionHandler);
[Deprecated (PlatformName.iOS, 10,0, message: "Use 'DidReceiveNotification' instead.")]
[Deprecated (PlatformName.WatchOS, 3,0, message: "Use 'DidReceiveNotification' instead.")] [Deprecated (PlatformName.WatchOS, 3,0, message: "Use 'DidReceiveNotification' instead.")]
[Export ("didReceiveLocalNotification:withCompletion:")] [Export ("didReceiveLocalNotification:withCompletion:")]
void DidReceiveLocalNotification (UILocalNotification localNotification, Action<WKUserNotificationInterfaceType> completionHandler); void DidReceiveLocalNotification (UILocalNotification localNotification, Action<WKUserNotificationInterfaceType> completionHandler);
[Deprecated (PlatformName.WatchOS, 5,0, message: "Use 'DidReceiveNotification(UNNotification)' instead.")] [Deprecated (PlatformName.WatchOS, 5,0, message: "Use 'DidReceiveNotification(UNNotification)' instead.")]
[Watch (3,0)][iOS (10,0)] [Watch (3,0)]
[Export ("didReceiveNotification:withCompletion:")] [Export ("didReceiveNotification:withCompletion:")]
void DidReceiveNotification (UNNotification notification, Action<WKUserNotificationInterfaceType> completionHandler); void DidReceiveNotification (UNNotification notification, Action<WKUserNotificationInterfaceType> completionHandler);
[NoiOS]
[Deprecated (PlatformName.WatchOS, 3,0, message: "Use overload accepting an 'UNNotification' parameter.")] [Deprecated (PlatformName.WatchOS, 3,0, message: "Use overload accepting an 'UNNotification' parameter.")]
[Export ("suggestionsForResponseToActionWithIdentifier:forRemoteNotification:inputLanguage:")] [Export ("suggestionsForResponseToActionWithIdentifier:forRemoteNotification:inputLanguage:")]
string[] GetSuggestionsForResponseToAction (string identifier, NSDictionary remoteNotification, string inputLanguage); string[] GetSuggestionsForResponseToAction (string identifier, NSDictionary remoteNotification, string inputLanguage);
[NoiOS]
[Deprecated (PlatformName.WatchOS, 3,0, message: "Use overload accepting an 'UNNotification' parameter.")] [Deprecated (PlatformName.WatchOS, 3,0, message: "Use overload accepting an 'UNNotification' parameter.")]
[Export ("suggestionsForResponseToActionWithIdentifier:forLocalNotification:inputLanguage:")] [Export ("suggestionsForResponseToActionWithIdentifier:forLocalNotification:inputLanguage:")]
string[] GetSuggestionsForResponseToAction (string identifier, UILocalNotification localNotification, string inputLanguage); string[] GetSuggestionsForResponseToAction (string identifier, UILocalNotification localNotification, string inputLanguage);
[Watch (3,0)][NoiOS] [Watch (3,0)]
[Export ("suggestionsForResponseToActionWithIdentifier:forNotification:inputLanguage:")] [Export ("suggestionsForResponseToActionWithIdentifier:forNotification:inputLanguage:")]
string[] GetSuggestionsForResponseToAction (string identifier, UNNotification notification, string inputLanguage); string[] GetSuggestionsForResponseToAction (string identifier, UNNotification notification, string inputLanguage);
[Watch (5,0)][NoiOS] [Watch (5,0)]
[Export ("notificationActions", ArgumentSemantic.Copy)] [Export ("notificationActions", ArgumentSemantic.Copy)]
UNNotificationAction[] NotificationActions { get; set; } UNNotificationAction[] NotificationActions { get; set; }
[Watch (5,0)][NoiOS] [Watch (5,0)]
[Export ("didReceiveNotification:")] [Export ("didReceiveNotification:")]
void DidReceiveNotification (UNNotification notification); void DidReceiveNotification (UNNotification notification);
[Watch (5,0)][NoiOS] [Watch (5,0)]
[Export ("performNotificationDefaultAction")] [Export ("performNotificationDefaultAction")]
void PerformNotificationDefaultAction (); void PerformNotificationDefaultAction ();
[Watch (5,0)][NoiOS] [Watch (5,0)]
[Export ("performDismissAction")] [Export ("performDismissAction")]
void PerformDismissAction (); void PerformDismissAction ();
@ -336,7 +323,6 @@ namespace WatchKit {
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[BaseType (typeof (NSObject))] [BaseType (typeof (NSObject))]
[DisableDefaultCtor] [DisableDefaultCtor]
@ -357,38 +343,29 @@ namespace WatchKit {
[Export ("setHeight:")] [Export ("setHeight:")]
void SetHeight (nfloat height); void SetHeight (nfloat height);
[Watch (2,1), NoiOS] [Watch (2,1)]
[Export ("setSemanticContentAttribute:")] [Export ("setSemanticContentAttribute:")]
void SetSemanticContentAttribute (WKInterfaceSemanticContentAttribute semanticContentAttribute); void SetSemanticContentAttribute (WKInterfaceSemanticContentAttribute semanticContentAttribute);
#if WATCH
[NoiOS]
[Export ("setHorizontalAlignment:")] [Export ("setHorizontalAlignment:")]
void SetHorizontalAlignment (WKInterfaceObjectHorizontalAlignment horizontalAlignment); void SetHorizontalAlignment (WKInterfaceObjectHorizontalAlignment horizontalAlignment);
[NoiOS]
[Export ("setVerticalAlignment:")] [Export ("setVerticalAlignment:")]
void SetVerticalAlignment (WKInterfaceObjectVerticalAlignment verticalAlignment); void SetVerticalAlignment (WKInterfaceObjectVerticalAlignment verticalAlignment);
#endif
[NoiOS]
[Export ("setRelativeWidth:withAdjustment:")] [Export ("setRelativeWidth:withAdjustment:")]
void SetRelativeWidth (nfloat width, nfloat adjustment); void SetRelativeWidth (nfloat width, nfloat adjustment);
[NoiOS]
[Export ("setRelativeHeight:withAdjustment:")] [Export ("setRelativeHeight:withAdjustment:")]
void SetRelativeHeight (nfloat height, nfloat adjustment); void SetRelativeHeight (nfloat height, nfloat adjustment);
[NoiOS]
[Export ("sizeToFitWidth")] [Export ("sizeToFitWidth")]
void SizeToFitWidth (); void SizeToFitWidth ();
[NoiOS]
[Export ("sizeToFitHeight")] [Export ("sizeToFitHeight")]
void SizeToFitHeight (); void SizeToFitHeight ();
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[Category] [Category]
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
@ -414,18 +391,17 @@ namespace WatchKit {
[Export ("setAccessibilityIdentifier:")] [Export ("setAccessibilityIdentifier:")]
void SetAccessibilityIdentifier ([NullAllowed] string accessibilityIdentifier); void SetAccessibilityIdentifier ([NullAllowed] string accessibilityIdentifier);
[Watch (2,0)][NoiOS] [Watch (2,0)]
[Notification] [Notification]
[Field ("WKAccessibilityVoiceOverStatusChanged")] [Field ("WKAccessibilityVoiceOverStatusChanged")]
NSString VoiceOverStatusChanged { get; } NSString VoiceOverStatusChanged { get; }
[Watch (4,0)][NoiOS] [Watch (4,0)]
[Notification] [Notification]
[Field ("WKAccessibilityReduceMotionStatusDidChangeNotification")] [Field ("WKAccessibilityReduceMotionStatusDidChangeNotification")]
NSString ReduceMotionStatusDidChangeNotification { get; } NSString ReduceMotionStatusDidChangeNotification { get; }
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[BaseType (typeof (NSObject))] [BaseType (typeof (NSObject))]
[DisableDefaultCtor] // does not make sense to create, it should only be used thru the singleton [DisableDefaultCtor] // does not make sense to create, it should only be used thru the singleton
@ -464,81 +440,80 @@ namespace WatchKit {
[Export ("removeAllCachedImages")] [Export ("removeAllCachedImages")]
void RemoveAllCachedImages (); void RemoveAllCachedImages ();
[iOS (9,0), Watch (2,0)] [Watch (2,0)]
[Export ("systemVersion")] [Export ("systemVersion")]
string SystemVersion { get; } string SystemVersion { get; }
[iOS (9,0), Watch (2,0)] [Watch (2,0)]
[Export ("name")] [Export ("name")]
string Name { get; } string Name { get; }
[iOS (9,0), Watch (2,0)] [Watch (2,0)]
[Export ("model")] [Export ("model")]
string Model { get; } string Model { get; }
[iOS (9,0), Watch (2,0)] [Watch (2,0)]
[Export ("localizedModel")] [Export ("localizedModel")]
string LocalizedModel { get; } string LocalizedModel { get; }
[iOS (9,0)][Watch (2,0)] [Watch (2,0)]
[Export ("systemName")] [Export ("systemName")]
string SystemName { get; } string SystemName { get; }
[Watch (3,0)][NoiOS] [Watch (3,0)]
[Export ("waterResistanceRating")] [Export ("waterResistanceRating")]
WKWaterResistanceRating WaterResistanceRating { get; } WKWaterResistanceRating WaterResistanceRating { get; }
[Watch (2,0), NoiOS] [Watch (2,0)]
[Export ("playHaptic:")] [Export ("playHaptic:")]
void PlayHaptic (WKHapticType type); void PlayHaptic (WKHapticType type);
[Watch (2,1), NoiOS] [Watch (2,1)]
[Export ("layoutDirection")] [Export ("layoutDirection")]
WKInterfaceLayoutDirection LayoutDirection { get; } WKInterfaceLayoutDirection LayoutDirection { get; }
[Watch (2,1), NoiOS] [Watch (2,1)]
[Static] [Static]
[Export ("interfaceLayoutDirectionForSemanticContentAttribute:")] [Export ("interfaceLayoutDirectionForSemanticContentAttribute:")]
WKInterfaceLayoutDirection GetInterfaceLayoutDirection (WKInterfaceSemanticContentAttribute semanticContentAttribute); WKInterfaceLayoutDirection GetInterfaceLayoutDirection (WKInterfaceSemanticContentAttribute semanticContentAttribute);
[Watch (3,0)][NoiOS] [Watch (3,0)]
[Export ("wristLocation")] [Export ("wristLocation")]
WKInterfaceDeviceWristLocation WristLocation { get; } WKInterfaceDeviceWristLocation WristLocation { get; }
[Watch (3,0)][NoiOS] [Watch (3,0)]
[Export ("crownOrientation")] [Export ("crownOrientation")]
WKInterfaceDeviceCrownOrientation CrownOrientation { get; } WKInterfaceDeviceCrownOrientation CrownOrientation { get; }
[Watch (4,0)][NoiOS] [Watch (4,0)]
[Export ("batteryMonitoringEnabled")] [Export ("batteryMonitoringEnabled")]
bool BatteryMonitoringEnabled { [Bind ("isBatteryMonitoringEnabled")] get; set; } bool BatteryMonitoringEnabled { [Bind ("isBatteryMonitoringEnabled")] get; set; }
[Watch (4,0)][NoiOS] [Watch (4,0)]
[Export ("batteryLevel")] [Export ("batteryLevel")]
float BatteryLevel { get; } float BatteryLevel { get; }
[Watch (4,0)][NoiOS] [Watch (4,0)]
[Export ("batteryState")] [Export ("batteryState")]
WKInterfaceDeviceBatteryState BatteryState { get; } WKInterfaceDeviceBatteryState BatteryState { get; }
[Watch (6,0)][NoiOS] [Watch (6,0)]
[Export ("supportsAudioStreaming")] [Export ("supportsAudioStreaming")]
bool SupportsAudioStreaming { get; } bool SupportsAudioStreaming { get; }
[Watch (6,2), NoiOS] [Watch (6,2)]
[NullAllowed, Export ("identifierForVendor", ArgumentSemantic.Strong)] [NullAllowed, Export ("identifierForVendor", ArgumentSemantic.Strong)]
NSUuid IdentifierForVendor { get; } NSUuid IdentifierForVendor { get; }
[Watch (6,1)][NoiOS] [Watch (6,1)]
[Export ("enableWaterLock")] [Export ("enableWaterLock")]
void EnableWaterLock (); void EnableWaterLock ();
[Watch (6,1)][NoiOS] [Watch (6,1)]
[Export ("isWaterLockEnabled")] [Export ("isWaterLockEnabled")]
bool IsWaterLockEnabled { get; } bool IsWaterLockEnabled { get; }
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
@ -565,7 +540,6 @@ namespace WatchKit {
void SetEnabled (bool enabled); void SetEnabled (bool enabled);
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
@ -585,12 +559,10 @@ namespace WatchKit {
[Export ("setCornerRadius:")] [Export ("setCornerRadius:")]
void SetCornerRadius (nfloat cornerRadius); void SetCornerRadius (nfloat cornerRadius);
[NoiOS]
[Export ("setContentInset:")] [Export ("setContentInset:")]
void SetContentInset (UIEdgeInsets contentInset); void SetContentInset (UIEdgeInsets contentInset);
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
@ -608,7 +580,6 @@ namespace WatchKit {
void SetTintColor ([NullAllowed] UIColor color); void SetTintColor ([NullAllowed] UIColor color);
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
@ -624,7 +595,6 @@ namespace WatchKit {
void SetText ([NullAllowed] NSAttributedString attributedText); void SetText ([NullAllowed] NSAttributedString attributedText);
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
@ -639,7 +609,6 @@ namespace WatchKit {
void SetCalendar ([NullAllowed] NSCalendar calendar); void SetCalendar ([NullAllowed] NSCalendar calendar);
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
@ -658,7 +627,6 @@ namespace WatchKit {
void Stop (); void Stop ();
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
@ -685,20 +653,19 @@ namespace WatchKit {
[Export ("scrollToRowAtIndex:")] [Export ("scrollToRowAtIndex:")]
void ScrollToRow (nint index); void ScrollToRow (nint index);
[Watch (3,0)][NoiOS] [Watch (3,0)]
[Export ("performSegueForRow:")] [Export ("performSegueForRow:")]
void PerformSegue (nint row); void PerformSegue (nint row);
[Watch (5,1), NoiOS] [Watch (5,1)]
[Export ("curvesAtTop")] [Export ("curvesAtTop")]
bool CurvesAtTop { get; set; } bool CurvesAtTop { get; set; }
[Watch (5,1), NoiOS] [Watch (5,1)]
[Export ("curvesAtBottom")] [Export ("curvesAtBottom")]
bool CurvesAtBottom { get; set; } bool CurvesAtBottom { get; set; }
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
@ -741,7 +708,6 @@ namespace WatchKit {
void SetUserTrackingMode (WKInterfaceMapUserTrackingMode mode, bool animated); void SetUserTrackingMode (WKInterfaceMapUserTrackingMode mode, bool animated);
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
@ -750,7 +716,6 @@ namespace WatchKit {
void SetColor ([NullAllowed] UIColor color); void SetColor ([NullAllowed] UIColor color);
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
@ -768,7 +733,6 @@ namespace WatchKit {
void SetNumberOfSteps (nint numberOfSteps); void SetNumberOfSteps (nint numberOfSteps);
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called [DisableDefaultCtor] // Do not subclass or create instances of this class yourself. -> Handle is nil if init is called
[BaseType (typeof (WKInterfaceObject))] [BaseType (typeof (WKInterfaceObject))]
@ -790,7 +754,6 @@ namespace WatchKit {
void SetTitle ([NullAllowed] NSAttributedString attributedTitle); void SetTitle ([NullAllowed] NSAttributedString attributedTitle);
} }
[iOS (8,2)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[BaseType (typeof (NSObject))] [BaseType (typeof (NSObject))]
interface WKAccessibilityImageRegion { interface WKAccessibilityImageRegion {
@ -804,21 +767,18 @@ namespace WatchKit {
interface IWKImageAnimatable {} interface IWKImageAnimatable {}
[iOS (9,0)]
[Unavailable (PlatformName.iOS)] [Unavailable (PlatformName.iOS)]
[Protocol] [Protocol]
interface WKImageAnimatable { interface WKImageAnimatable {
[iOS (8,2)]
[Abstract] [Abstract]
[Export ("startAnimating")] [Export ("startAnimating")]
void StartAnimating (); void StartAnimating ();
[iOS (8,2)]
[Abstract] [Abstract]
[Export ("startAnimatingWithImagesInRange:duration:repeatCount:")] [Export ("startAnimatingWithImagesInRange:duration:repeatCount:")]
void StartAnimating (NSRange imageRange, double duration, nint repeatCount); void StartAnimating (NSRange imageRange, double duration, nint repeatCount);
[iOS (8,2)]
[Abstract] [Abstract]
[Export ("stopAnimating")] [Export ("stopAnimating")]
void StopAnimating (); void StopAnimating ();
@ -954,17 +914,17 @@ namespace WatchKit {
void SetCurrentTime (double time); void SetCurrentTime (double time);
#endif #endif
[Watch (2,0), NoiOS] [Watch (2,0)]
[Notification] [Notification]
[Field ("WKAudioFilePlayerItemTimeJumpedNotification")] [Field ("WKAudioFilePlayerItemTimeJumpedNotification")]
NSString TimeJumpedNotification { get; } NSString TimeJumpedNotification { get; }
[Watch (2,0), NoiOS] [Watch (2,0)]
[Notification] [Notification]
[Field ("WKAudioFilePlayerItemDidPlayToEndTimeNotification")] [Field ("WKAudioFilePlayerItemDidPlayToEndTimeNotification")]
NSString DidPlayToEndTimeNotification { get; } NSString DidPlayToEndTimeNotification { get; }
[Watch (2,0), NoiOS] [Watch (2,0)]
[Notification] [Notification]
[Field ("WKAudioFilePlayerItemFailedToPlayToEndTimeNotification")] [Field ("WKAudioFilePlayerItemFailedToPlayToEndTimeNotification")]
NSString FailedToPlayToEndTimeNotification { get; } NSString FailedToPlayToEndTimeNotification { get; }
@ -1037,23 +997,23 @@ namespace WatchKit {
[Export ("globalTintColor")] [Export ("globalTintColor")]
UIColor GlobalTintColor { get; } UIColor GlobalTintColor { get; }
[Watch (7, 0), NoiOS] [Watch (7, 0)]
[Notification, Field ("WKApplicationDidFinishLaunchingNotification")] [Notification, Field ("WKApplicationDidFinishLaunchingNotification")]
NSString DidFinishLaunchingNotification { get; } NSString DidFinishLaunchingNotification { get; }
[Watch (7, 0), NoiOS] [Watch (7, 0)]
[Notification, Field ("WKApplicationDidBecomeActiveNotification")] [Notification, Field ("WKApplicationDidBecomeActiveNotification")]
NSString DidBecomeActiveNotification { get; } NSString DidBecomeActiveNotification { get; }
[Watch (7, 0), NoiOS] [Watch (7, 0)]
[Notification, Field ("WKApplicationWillResignActiveNotification")] [Notification, Field ("WKApplicationWillResignActiveNotification")]
NSString WillResignActiveNotification { get; } NSString WillResignActiveNotification { get; }
[Watch (7, 0), NoiOS] [Watch (7, 0)]
[Notification, Field ("WKApplicationWillEnterForegroundNotification")] [Notification, Field ("WKApplicationWillEnterForegroundNotification")]
NSString WillEnterForegroundNotification { get; } NSString WillEnterForegroundNotification { get; }
[Watch (7, 0), NoiOS] [Watch (7, 0)]
[Notification, Field ("WKApplicationDidEnterBackgroundNotification")] [Notification, Field ("WKApplicationDidEnterBackgroundNotification")]
NSString DidEnterBackgroundNotification { get; } NSString DidEnterBackgroundNotification { get; }
} }

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

@ -30,37 +30,33 @@ namespace Introspection {
protected Version Minimum { get; set; } protected Version Minimum { get; set; }
protected Version Maximum { get; set; } protected Version Maximum { get; set; }
protected Func<AvailabilityBaseAttribute,bool> Filter { get; set; } protected Func<AvailabilityBaseAttribute, bool> Filter { get; set; }
protected PlatformName Platform { get; set; }
public ApiAvailabilityTest () public ApiAvailabilityTest ()
{ {
Maximum = Version.Parse (Constants.SdkVersion); Maximum = Version.Parse (Constants.SdkVersion);
#if __IOS__ #if __IOS__
Platform = PlatformName.iOS;
Minimum = new Version (6,0); Minimum = new Version (6,0);
Filter = (AvailabilityBaseAttribute arg) => {
return (arg.AvailabilityKind != AvailabilityKind.Introduced) || (arg.Platform != PlatformName.iOS);
};
#elif __TVOS__ #elif __TVOS__
Platform = PlatformName.TvOS;
Minimum = new Version (9,0); Minimum = new Version (9,0);
Filter = (AvailabilityBaseAttribute arg) => {
return (arg.AvailabilityKind != AvailabilityKind.Introduced) || (arg.Platform != PlatformName.TvOS);
};
#elif __WATCHOS__ #elif __WATCHOS__
Platform = PlatformName.WatchOS;
Minimum = new Version (2,0); Minimum = new Version (2,0);
// Need to special case watchOS 'Maximum' version for OS minor subversions (can't change Constants.SdkVersion) // Need to special case watchOS 'Maximum' version for OS minor subversions (can't change Constants.SdkVersion)
//Maximum = new Version (6,2,5); //Maximum = new Version (6,2,5);
Filter = (AvailabilityBaseAttribute arg) => {
return (arg.AvailabilityKind != AvailabilityKind.Introduced) || (arg.Platform != PlatformName.WatchOS);
};
#else #else
Platform = PlatformName.MacOSX;
Minimum = new Version (10,9); Minimum = new Version (10,9);
// Need to special case macOS 'Maximum' version for OS minor subversions (can't change Constants.SdkVersion) // Need to special case macOS 'Maximum' version for OS minor subversions (can't change Constants.SdkVersion)
// Please comment the code below if needed // Please comment the code below if needed
Maximum = new Version (10,15,5); Maximum = new Version (10,15,5);
Filter = (AvailabilityBaseAttribute arg) => {
return (arg.AvailabilityKind != AvailabilityKind.Introduced) || (arg.Platform != PlatformName.MacOSX);
};
#endif #endif
Filter = (AvailabilityBaseAttribute arg) => {
return (arg.AvailabilityKind != AvailabilityKind.Introduced) || (arg.Platform != Platform);
};
} }
bool FoundInProtocols (MemberInfo m, Type t) bool FoundInProtocols (MemberInfo m, Type t)
@ -205,5 +201,56 @@ namespace Introspection {
} }
return null; return null;
} }
bool IsUnavailable (ICustomAttributeProvider cap)
{
foreach (var ca in cap.GetCustomAttributes (false)) {
if (ca is UnavailableAttribute ua) {
if (ua.Platform == Platform)
return true;
}
}
return false;
}
AvailabilityBaseAttribute GetAvailable (ICustomAttributeProvider cap)
{
foreach (var ca in cap.GetCustomAttributes (false)) {
if (ca is AvailabilityBaseAttribute aa) {
if ((aa.AvailabilityKind != AvailabilityKind.Unavailable) && (aa.Platform == Platform))
return aa;
}
}
return null;
}
[Test]
public void Unavailable ()
{
//LogProgress = true;
Errors = 0;
foreach (Type t in Assembly.GetTypes ()) {
if (LogProgress)
Console.WriteLine ($"T: {t}");
var tu = IsUnavailable (t);
var ta = GetAvailable (t);
if (tu && (ta != null))
AddErrorLine ($"[FAIL] {t.FullName} is marked both [Unavailable ({Platform})] and {ta}.");
foreach (var m in t.GetMembers (BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)) {
if (LogProgress)
Console.WriteLine ($"M: {m}");
var ma = GetAvailable (t);
if (tu && (ma != null))
AddErrorLine ($"[FAIL] {m} is marked with {ma} but the type {t.FullName} is [Unavailable ({Platform})].");
var mu = IsUnavailable (t);
if (mu && (ma != null))
AddErrorLine ($"[FAIL] {m} is marked both [Unavailable ({Platform})] and {ma}.");
}
}
AssertIfErrors ("{0} API with mixed [Unavailable] and availability attributes", Errors);
}
} }
} }