diff --git a/docs/website/binding_types_reference_guide.md b/docs/website/binding_types_reference_guide.md index e94323e3fa..992fc06006 100644 --- a/docs/website/binding_types_reference_guide.md +++ b/docs/website/binding_types_reference_guide.md @@ -727,8 +727,9 @@ It's possible to customize the name of the Objective-C class in two ways: [Model (Name = "CustomName")] ``` -It's recommended to use `AutoGeneratedName = true` (this may become the -default in the future). +It's recommended to use `AutoGeneratedName = true`. In .NET, the name is +always generated (unless it's explicitly specified as in 2. above), and the +`AutoGeneratedName` property does not exist anymore. diff --git a/src/Foundation/ModelAttribute.cs b/src/Foundation/ModelAttribute.cs index 783a336f74..4536a3f20c 100644 --- a/src/Foundation/ModelAttribute.cs +++ b/src/Foundation/ModelAttribute.cs @@ -30,6 +30,8 @@ namespace Foundation { public ModelAttribute () {} public string Name { get; set; } +#if !NET public bool AutoGeneratedName { get; set; } +#endif } } diff --git a/src/appkit.cs b/src/appkit.cs index add345979e..40cb0e0e4c 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -27636,7 +27636,11 @@ namespace AppKit { [Mac (10,15)] [NoMacCatalyst] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSSharingServicePickerDelegate))] interface NSSharingServicePickerToolbarItemDelegate { diff --git a/src/arkit.cs b/src/arkit.cs index 152b16322e..e46d68e370 100644 --- a/src/arkit.cs +++ b/src/arkit.cs @@ -1821,7 +1821,11 @@ namespace ARKit { interface IARCoachingOverlayViewDelegate {} [iOS (13,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface ARCoachingOverlayViewDelegate { diff --git a/src/authenticationservices.cs b/src/authenticationservices.cs index 200fe48834..bde216bf52 100644 --- a/src/authenticationservices.cs +++ b/src/authenticationservices.cs @@ -378,7 +378,11 @@ namespace AuthenticationServices { interface IASAuthorizationControllerDelegate {} [Watch (6,0), TV (13,0), Mac (10,15), iOS (13,0)] +#if NET + [Protocol][Model] +#else [Protocol][Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface ASAuthorizationControllerDelegate { @@ -735,7 +739,11 @@ namespace AuthenticationServices { [Mac (10,15)] [Introduced (PlatformName.MacCatalyst, 13, 0)] [NoTV][NoiOS][NoWatch] +#if NET + [Protocol][Model] +#else [Protocol][Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface ASWebAuthenticationSessionRequestDelegate { @@ -826,7 +834,11 @@ namespace AuthenticationServices { [Introduced (PlatformName.MacCatalyst, 14, 0)] [iOS (14,0)] [NoWatch, NoTV, NoMac] +#if NET + [Protocol][Model] +#else [Protocol][Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface ASAccountAuthenticationModificationControllerDelegate { diff --git a/src/automaticassessmentconfiguration.cs b/src/automaticassessmentconfiguration.cs index 7358dbd2f3..3c94ccecb3 100644 --- a/src/automaticassessmentconfiguration.cs +++ b/src/automaticassessmentconfiguration.cs @@ -131,7 +131,11 @@ namespace AutomaticAssessmentConfiguration { [Mac (10,15,4), iOS (13,4)] [MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface AEAssessmentSessionDelegate { diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 53c907b274..a6bfe5a357 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -4166,8 +4166,12 @@ namespace AVFoundation { interface IAVAssetWriterDelegate { } [TV (14,0), NoWatch, Mac (11,0), iOS (14,0)] +#if NET + [Protocol, Model] +#else [Protocol] [Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface AVAssetWriterDelegate { [Export ("assetWriter:didOutputSegmentData:segmentType:segmentReport:")] @@ -15100,7 +15104,11 @@ namespace AVFoundation { interface IAVPlaybackCoordinatorPlaybackControlDelegate {} [TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface AVPlaybackCoordinatorPlaybackControlDelegate { @@ -15265,7 +15273,11 @@ namespace AVFoundation { interface IAVPlayerPlaybackCoordinatorDelegate {} [TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface AVPlayerPlaybackCoordinatorDelegate { diff --git a/src/avkit.cs b/src/avkit.cs index 09a2bfe7f2..705f2789b9 100644 --- a/src/avkit.cs +++ b/src/avkit.cs @@ -554,7 +554,11 @@ namespace AVKit { [NoiOS, NoWatch, NoTV] [Mac (10,15)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface AVPlayerViewPictureInPictureDelegate { @@ -879,7 +883,11 @@ namespace AVKit { interface IAVPictureInPictureSampleBufferPlaybackDelegate {} [TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface AVPictureInPictureSampleBufferPlaybackDelegate { @@ -908,7 +916,11 @@ namespace AVKit { } [Mac (12,0), NoiOS, NoTV, NoMacCatalyst] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface AVPlayerViewDelegate { diff --git a/src/carplay.cs b/src/carplay.cs index 1cfa82afcc..2c71e33a90 100644 --- a/src/carplay.cs +++ b/src/carplay.cs @@ -417,7 +417,11 @@ namespace CarPlay { interface ICPInterfaceControllerDelegate { } [NoWatch, NoTV, NoMac, iOS (12,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CPInterfaceControllerDelegate { @@ -439,7 +443,11 @@ namespace CarPlay { [Introduced (PlatformName.iOS, 12,0)] [Deprecated (PlatformName.iOS, 13,0, message: "Use 'CPTemplateApplicationSceneDelegate' instead.")] [NoWatch, NoTV, NoMac] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CPApplicationDelegate : UIApplicationDelegate { @@ -674,7 +682,11 @@ namespace CarPlay { [Deprecated (PlatformName.iOS, 14, 0, message: "Use 'CPListItem.Handler' instead.")] [NoWatch, NoTV, NoMac, iOS (12,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CPListTemplateDelegate { @@ -838,7 +850,11 @@ namespace CarPlay { interface ICPMapTemplateDelegate { } [NoWatch, NoTV, NoMac, iOS (12,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CPMapTemplateDelegate { @@ -983,7 +999,11 @@ namespace CarPlay { delegate void CPSearchTemplateDelegateUpdateHandler (CPListItem [] searchResults); [NoWatch, NoTV, NoMac, iOS (12,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CPSearchTemplateDelegate { @@ -1026,7 +1046,11 @@ namespace CarPlay { interface ICPSessionConfigurationDelegate { } [NoWatch, NoTV, NoMac, iOS (12,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model ( AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CPSessionConfigurationDelegate { @@ -1168,7 +1192,11 @@ namespace CarPlay { interface ICPTemplateApplicationSceneDelegate { } [NoWatch, NoTV, NoMac, iOS (13,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CPTemplateApplicationSceneDelegate : UISceneDelegate { @@ -1335,7 +1363,11 @@ namespace CarPlay { interface ICPTemplateApplicationDashboardSceneDelegate { } [NoWatch, NoTV, NoMac, iOS (13,4)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CPTemplateApplicationDashboardSceneDelegate : UISceneDelegate { @@ -1716,7 +1748,11 @@ namespace CarPlay { interface ICPPointOfInterestTemplateDelegate { } [NoWatch, NoTV, NoMac, iOS (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface CPPointOfInterestTemplateDelegate { @@ -1760,7 +1796,11 @@ namespace CarPlay { interface ICPTabBarTemplateDelegate { } [NoWatch, NoTV, NoMac, iOS (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CPTabBarTemplateDelegate { diff --git a/src/chip.cs b/src/chip.cs index 45e07a60ba..744cdbb167 100644 --- a/src/chip.cs +++ b/src/chip.cs @@ -1617,7 +1617,11 @@ namespace Chip { interface IChipDevicePairingDelegate {} [Mac (12,0), Watch (8,0), TV (15,0), iOS (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject), Name="CHIPDevicePairingDelegate")] interface ChipDevicePairingDelegate { @@ -1719,7 +1723,11 @@ namespace Chip { interface IChipPersistentStorageDelegate {} [Mac (12,0), Watch (8,0), TV (15,0), iOS (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject), Name="CHIPPersistentStorageDelegate")] interface ChipPersistentStorageDelegate { diff --git a/src/coremidi.cs b/src/coremidi.cs index dae8730384..98ed3b4c1e 100644 --- a/src/coremidi.cs +++ b/src/coremidi.cs @@ -434,7 +434,11 @@ namespace CoreMidi { [Mac (11, 0), iOS (14,0)] [MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject), Name="MIDICIProfileResponderDelegate")] interface MidiCIProfileResponderDelegate { diff --git a/src/coreml.cs b/src/coreml.cs index 7130564aef..47625fbac6 100644 --- a/src/coreml.cs +++ b/src/coreml.cs @@ -696,7 +696,11 @@ namespace CoreML { [Watch (5,0), TV (12,0), Mac (10,14), iOS (12,0)] [BaseType (typeof(NSObject))] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif interface MLCustomModel { // [Abstract] diff --git a/src/coremotion.cs b/src/coremotion.cs index 0106b99f9a..c34a263139 100644 --- a/src/coremotion.cs +++ b/src/coremotion.cs @@ -722,7 +722,11 @@ namespace CoreMotion { [iOS (14,0)][Watch (7,0)] [MacCatalyst (14,0)] [NoMac] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CMHeadphoneMotionManagerDelegate { @@ -799,7 +803,11 @@ namespace CoreMotion { interface ICMFallDetectionDelegate {} [Watch (7,2), NoTV, NoMac, NoiOS] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CMFallDetectionDelegate { diff --git a/src/corenfc.cs b/src/corenfc.cs index 1f0e6ad938..f251390ece 100644 --- a/src/corenfc.cs +++ b/src/corenfc.cs @@ -977,7 +977,11 @@ namespace CoreNFC { interface INFCTagReaderSessionDelegate {} [iOS (13,0)] +#if NET + [Protocol][Model] +#else [Protocol][Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface NFCTagReaderSessionDelegate { @@ -1021,7 +1025,11 @@ namespace CoreNFC { interface INFCVasReaderSessionDelegate {} [iOS (13,0)] +#if NET + [Protocol][Model] +#else [Protocol][Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject), Name = "NFCVASReaderSessionDelegate")] interface NFCVasReaderSessionDelegate { diff --git a/src/coretelephony.cs b/src/coretelephony.cs index 9143700774..16ba136b88 100644 --- a/src/coretelephony.cs +++ b/src/coretelephony.cs @@ -77,7 +77,11 @@ namespace CoreTelephony { [Obsoleted (PlatformName.iOS, 14,0, message: Constants.UseCallKitInstead)] [iOS (13,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface CTTelephonyNetworkInfoDelegate { diff --git a/src/foundation.cs b/src/foundation.cs index bc895bf669..1796a8b236 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -16035,7 +16035,11 @@ namespace Foundation } [BaseType (typeof (NSObject), Name = "NSXPCListenerDelegate")] +#if NET + [Protocol, Model] +#else [Model (AutoGeneratedName = true), Protocol] +#endif interface NSXpcListenerDelegate { [Export ("listener:shouldAcceptNewConnection:")] @@ -16391,7 +16395,11 @@ namespace Foundation } [Watch (6,0), TV (13,0), Mac (10,15), iOS (13,0)] +#if NET + [Protocol][Model] +#else [Protocol][Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSUrlSessionTaskDelegate), Name = "NSURLSessionWebSocketDelegate")] interface NSUrlSessionWebSocketDelegate { diff --git a/src/generator.cs b/src/generator.cs index 814550b97c..5eee992027 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -6476,7 +6476,13 @@ public partial class Generator : IMemberGatherer { if (is_model) { if (!string.IsNullOrEmpty (model.Name)) { register_name = model.Name; +#if NET + } else { + // For .NET, we'll always generate the Objective-C name. If a user wants to use a different name, + // they can set the model name (so we'll enter the previous condition) +#else } else if (model.AutoGeneratedName) { +#endif register_name = Registrar.Registrar.SanitizeObjectiveCName (GetAssemblyName () + "__" + type.FullName); } } diff --git a/src/homekit.cs b/src/homekit.cs index a885ec0d9a..3556a66ac7 100644 --- a/src/homekit.cs +++ b/src/homekit.cs @@ -1793,7 +1793,11 @@ namespace HomeKit { interface IHMNetworkConfigurationProfileDelegate {} [Watch (6,0), TV (13,0), NoMac, iOS (13,0), MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface HMNetworkConfigurationProfileDelegate { [Export ("profileDidUpdateNetworkAccessMode:")] diff --git a/src/imagecapturecore.cs b/src/imagecapturecore.cs index 1807f887ad..faa0ad5afb 100644 --- a/src/imagecapturecore.cs +++ b/src/imagecapturecore.cs @@ -148,7 +148,11 @@ namespace ImageCaptureCore { NSString Transfer { get; } } +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface ICDeviceDelegate { @@ -285,7 +289,11 @@ namespace ImageCaptureCore { interface IICDeviceBrowserDelegate {} +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface ICDeviceBrowserDelegate { @@ -419,7 +427,11 @@ namespace ImageCaptureCore { ICCameraItem[] SidecarFiles { get; } } +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface ICCameraDeviceDelegate : ICDeviceDelegate { @@ -474,7 +486,11 @@ namespace ImageCaptureCore { interface IICCameraDeviceDownloadDelegate {} +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface ICCameraDeviceDownloadDelegate { @@ -843,7 +859,11 @@ namespace ImageCaptureCore { interface IICScannerDeviceDelegate {} +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface ICScannerDeviceDelegate : ICDeviceDelegate { diff --git a/src/intentsui.cs b/src/intentsui.cs index fc6172ed54..07b1460c3b 100644 --- a/src/intentsui.cs +++ b/src/intentsui.cs @@ -138,7 +138,11 @@ namespace IntentsUI { [Mac (12,0)] [iOS (12,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface INUIAddVoiceShortcutViewControllerDelegate { @@ -177,7 +181,11 @@ namespace IntentsUI { [Mac (12,0)] [iOS (12,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface INUIEditVoiceShortcutViewControllerDelegate { @@ -233,7 +241,11 @@ namespace IntentsUI { interface IINUIAddVoiceShortcutButtonDelegate {} [NoWatch, NoTV, Mac (12,0), iOS (12,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface INUIAddVoiceShortcutButtonDelegate { diff --git a/src/javascriptcore.cs b/src/javascriptcore.cs index 11f063d269..e19d3d2c08 100644 --- a/src/javascriptcore.cs +++ b/src/javascriptcore.cs @@ -368,7 +368,11 @@ namespace JavaScriptCore { } [Mac (10,9), iOS (7,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface JSExport { diff --git a/src/mediaplayer.cs b/src/mediaplayer.cs index ffac5bb55b..753c355118 100644 --- a/src/mediaplayer.cs +++ b/src/mediaplayer.cs @@ -2283,7 +2283,11 @@ namespace MediaPlayer { [TV (14,0)] [NoWatch, NoMac, NoiOS] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface MPNowPlayingSessionDelegate { diff --git a/src/metal.cs b/src/metal.cs index 917eda4a5a..51143d83cc 100644 --- a/src/metal.cs +++ b/src/metal.cs @@ -4071,7 +4071,11 @@ namespace Metal { interface IMTLCaptureScope { } [Mac (10,13), iOS (11,0), TV (11,0), NoWatch] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface MTLCaptureScope { diff --git a/src/metalperformanceshaders.cs b/src/metalperformanceshaders.cs index fea2691a22..f63da63307 100644 --- a/src/metalperformanceshaders.cs +++ b/src/metalperformanceshaders.cs @@ -6926,7 +6926,11 @@ namespace MetalPerformanceShaders { interface IMPSCnnBatchNormalizationDataSource { } [TV (11,3), Mac (10,13,4), iOS (11,3)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject), Name = "MPSCNNBatchNormalizationDataSource")] interface MPSCnnBatchNormalizationDataSource : NSCopying { @@ -7297,7 +7301,11 @@ namespace MetalPerformanceShaders { interface IMPSCnnInstanceNormalizationDataSource { } [TV (11,3), Mac (10,13,4), iOS (11,3)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject), Name = "MPSCNNInstanceNormalizationDataSource")] interface MPSCnnInstanceNormalizationDataSource : NSCopying { diff --git a/src/nearbyinteraction.cs b/src/nearbyinteraction.cs index cdf05f0a00..e8ef8f5f87 100644 --- a/src/nearbyinteraction.cs +++ b/src/nearbyinteraction.cs @@ -105,8 +105,12 @@ namespace NearbyInteraction { [Watch (8,0), NoTV, NoMac, iOS (14,0)] [MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol] [Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface NISessionDelegate { diff --git a/src/networkextension.cs b/src/networkextension.cs index ea7e427f3d..a362d9b534 100644 --- a/src/networkextension.cs +++ b/src/networkextension.cs @@ -2332,7 +2332,11 @@ namespace NetworkExtension { [NoWatch, NoTV, NoMac, iOS (14,0)] [MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface NEAppPushDelegate { diff --git a/src/passkit.cs b/src/passkit.cs index 03d511f695..47572fa6c6 100644 --- a/src/passkit.cs +++ b/src/passkit.cs @@ -1592,7 +1592,11 @@ namespace PassKit { [NoWatch, NoTV, NoMac] // under `#if TARGET_OS_IOS` [iOS (13,4)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface PKAddSecureElementPassViewControllerDelegate { diff --git a/src/pencilkit.cs b/src/pencilkit.cs index e4b01ab4b1..a70610ec2e 100644 --- a/src/pencilkit.cs +++ b/src/pencilkit.cs @@ -72,7 +72,11 @@ namespace PencilKit { [iOS (13, 0), NoMac] [Introduced (PlatformName.MacCatalyst, 14, 0)] [BaseType (typeof (NSObject))] +#if NET + [Protocol, Model] +#else [Model (AutoGeneratedName = true)] [Protocol] +#endif interface PKCanvasViewDelegate : UIScrollViewDelegate { [Export ("canvasViewDrawingDidChange:")] diff --git a/src/photosui.cs b/src/photosui.cs index 236373ca31..0194a11eeb 100644 --- a/src/photosui.cs +++ b/src/photosui.cs @@ -492,7 +492,11 @@ namespace PhotosUI { [NoWatch, NoTV, NoMac, iOS (14,0)] [MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface PHPickerViewControllerDelegate { diff --git a/src/replaykit.cs b/src/replaykit.cs index 405fd64462..cf1030686b 100644 --- a/src/replaykit.cs +++ b/src/replaykit.cs @@ -420,7 +420,11 @@ namespace ReplayKit { [Mac (11,0)] [NoiOS] [NoTV] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface RPBroadcastActivityControllerDelegate { diff --git a/src/sensorkit.cs b/src/sensorkit.cs index 6c0413a032..7dc2a5e15c 100644 --- a/src/sensorkit.cs +++ b/src/sensorkit.cs @@ -709,7 +709,11 @@ namespace SensorKit { [NoWatch, NoTV, NoMac] [iOS (14,0)] [MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface SRSensorReaderDelegate { diff --git a/src/shazamkit.cs b/src/shazamkit.cs index 6a28b92a3f..864b42a43a 100644 --- a/src/shazamkit.cs +++ b/src/shazamkit.cs @@ -257,7 +257,11 @@ namespace ShazamKit { interface ISHSessionDelegate {} [iOS (15,0), Mac (12,0), Watch (8,0), TV (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface SHSessionDelegate { diff --git a/src/storekit.cs b/src/storekit.cs index 756ee4beb8..a3335f8ff2 100644 --- a/src/storekit.cs +++ b/src/storekit.cs @@ -997,8 +997,12 @@ namespace StoreKit { interface ISKPaymentQueueDelegate {} [Watch (6, 2), Mac (10,15), iOS (13,0)] +#if NET + [Protocol, Model] +#else [Protocol] [Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface SKPaymentQueueDelegate { [Export ("paymentQueue:shouldContinueTransaction:inStorefront:")] @@ -1148,7 +1152,11 @@ namespace StoreKit { [NoWatch, NoTV, NoMac, iOS (14,0)] [MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface SKOverlayDelegate { [Export ("storeOverlay:didFailToLoadWithError:")] diff --git a/src/tvmlkit.cs b/src/tvmlkit.cs index 95c2b67cf4..a417642321 100644 --- a/src/tvmlkit.cs +++ b/src/tvmlkit.cs @@ -1130,7 +1130,11 @@ namespace TVMLKit { interface ITVBrowserViewControllerDataSource { } [TV (13,0)] +#if NET + [Protocol][Model] +#else [Protocol][Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface TVBrowserViewControllerDataSource { [Abstract] @@ -1142,7 +1146,11 @@ namespace TVMLKit { interface ITVBrowserViewControllerDelegate { } [TV (13,0)] +#if NET + [Protocol][Model] +#else [Protocol][Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface TVBrowserViewControllerDelegate { [Export ("browserViewController:willCenterOnViewElement:")] @@ -1200,7 +1208,11 @@ namespace TVMLKit { interface ITVDocumentViewControllerDelegate { } [TV (13,0)] +#if NET + [Protocol][Model] +#else [Protocol][Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface TVDocumentViewControllerDelegate { diff --git a/src/tvuikit.cs b/src/tvuikit.cs index 8246db7bee..dfb4fc7148 100644 --- a/src/tvuikit.cs +++ b/src/tvuikit.cs @@ -269,7 +269,11 @@ namespace TVUIKit { } [TV (13,0)] +#if NET + [Protocol, Model] +#else [Protocol][Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (UICollectionViewDelegate))] interface TVCollectionViewDelegateFullScreenLayout { [Export ("collectionView:layout:willCenterCellAtIndexPath:")] diff --git a/src/uikit.cs b/src/uikit.cs index 40489c1557..55f41847ca 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -306,7 +306,11 @@ namespace UIKit { [NoWatch, NoTV, iOS (15,0), MacCatalyst (15,0)] [BaseType (typeof (NSObject))] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif interface UISheetPresentationControllerDelegate : UIAdaptivePresentationControllerDelegate { [Export ("sheetPresentationControllerDidChangeSelectedDetentIdentifier:")] @@ -2855,7 +2859,11 @@ namespace UIKit { interface IUIContextMenuInteractionDelegate { } [NoWatch, NoTV, iOS (13,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UIContextMenuInteractionDelegate { @@ -13092,8 +13100,12 @@ namespace UIKit { } [BaseType (typeof (NSObject))] +#if NET + [Protocol, Model] +#else [Model (AutoGeneratedName = true)] [Protocol] +#endif interface UITableViewDataSource { [Export ("tableView:numberOfRowsInSection:")] @@ -20016,7 +20028,11 @@ namespace UIKit { interface IUISceneDelegate { } [iOS (13,0), TV (13,0), NoWatch] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UISceneDelegate { @@ -20436,7 +20452,11 @@ namespace UIKit { interface IUIFontPickerViewControllerDelegate { } [NoWatch, NoTV, iOS (13,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UIFontPickerViewControllerDelegate { @@ -20564,7 +20584,11 @@ namespace UIKit { interface IUILargeContentViewerInteractionDelegate { } [NoWatch, NoTV, iOS (13,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UILargeContentViewerInteractionDelegate { @@ -20723,7 +20747,11 @@ namespace UIKit { interface IUIScreenshotServiceDelegate { } [NoWatch, iOS (13,0), TV (13,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UIScreenshotServiceDelegate { @@ -20785,7 +20813,11 @@ namespace UIKit { interface IUISearchTextFieldDelegate { } [NoTV, iOS (13,0), NoWatch] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UISearchTextFieldDelegate : UITextFieldDelegate { @@ -20892,7 +20924,11 @@ namespace UIKit { interface IUITextFormattingCoordinatorDelegate { } [iOS (13,0), TV (13,0), NoWatch] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UITextFormattingCoordinatorDelegate { @@ -20947,7 +20983,11 @@ namespace UIKit { interface IUITextInteractionDelegate { } [iOS (13,0), NoTV, NoWatch] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UITextInteractionDelegate { @@ -21065,7 +21105,11 @@ namespace UIKit { interface IUIWindowSceneDelegate { } [iOS (13,0), TV (13,0), NoWatch] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UIWindowSceneDelegate : UISceneDelegate { @@ -21413,7 +21457,11 @@ namespace UIKit { interface IUIPointerInteractionDelegate { } [NoWatch, NoTV, iOS (13,4)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UIPointerInteractionDelegate { @@ -22070,7 +22118,11 @@ namespace UIKit { [NoWatch, NoTV, iOS (14,0)] [MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UIColorPickerViewControllerDelegate { @@ -22281,7 +22333,11 @@ namespace UIKit { [NoWatch, NoTV, iOS (14,0)] [MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UIIndirectScribbleInteractionDelegate { @@ -22577,7 +22633,11 @@ namespace UIKit { [NoWatch, NoTV, iOS (14,0)] [MacCatalyst (14,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UIScribbleInteractionDelegate { @@ -23104,7 +23164,11 @@ namespace UIKit { interface IUIToolTipInteractionDelegate {} [NoWatch, NoTV, iOS (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface UIToolTipInteractionDelegate { diff --git a/src/visionkit.cs b/src/visionkit.cs index c7b90ee0dd..0ced2fe7e9 100644 --- a/src/visionkit.cs +++ b/src/visionkit.cs @@ -50,7 +50,11 @@ namespace VisionKit { interface IVNDocumentCameraViewControllerDelegate { } [NoWatch, NoTV, NoMac, iOS (13,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface VNDocumentCameraViewControllerDelegate { diff --git a/src/watchkit.cs b/src/watchkit.cs index c3b88d3dda..01366468ab 100644 --- a/src/watchkit.cs +++ b/src/watchkit.cs @@ -1630,7 +1630,11 @@ namespace WatchKit { interface IWKExtendedRuntimeSessionDelegate {} [Watch (6,0), NoiOS] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface WKExtendedRuntimeSessionDelegate { diff --git a/src/webkit.cs b/src/webkit.cs index 3c2a92e75c..14825fca2c 100644 --- a/src/webkit.cs +++ b/src/webkit.cs @@ -423,7 +423,11 @@ namespace WebKit { interface IDomNodeFilter {} [Deprecated (PlatformName.MacOSX, 10, 14, message: "No longer supported.")] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject), Name="DOMNodeFilter")] interface DomNodeFilter { [Export ("acceptNode:")] @@ -2091,8 +2095,12 @@ namespace WebKit { [Deprecated (PlatformName.MacOSX, 10, 14, message: "No longer supported.")] [BaseType (typeof (NSObject))] +#if NET + [Protocol, Model] +#else [Model (AutoGeneratedName = true)] [Protocol] +#endif partial interface WebOpenPanelResultListener { [Export ("chooseFilename:")] void ChooseFilename (string filename); @@ -2126,8 +2134,12 @@ namespace WebKit { [Deprecated (PlatformName.MacOSX, 10, 14, message: "No longer supported.")] [BaseType (typeof (NSObject))] +#if NET + [Protocol, Model] +#else [Model (AutoGeneratedName = true)] [Protocol] +#endif partial interface WebPolicyDecisionListener { [Export ("use")] void Use (); diff --git a/src/wkwebkit.cs b/src/wkwebkit.cs index 21d8f996ac..a1a64e20fb 100644 --- a/src/wkwebkit.cs +++ b/src/wkwebkit.cs @@ -1297,7 +1297,11 @@ namespace WebKit [Mac (11,3)][iOS (14,5)] [MacCatalyst (14,5)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface WKDownloadDelegate { diff --git a/src/xkit.cs b/src/xkit.cs index 2ec4db89b2..829c925d76 100644 --- a/src/xkit.cs +++ b/src/xkit.cs @@ -3065,7 +3065,11 @@ namespace UIKit { } [TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface NSTextLayoutManagerDelegate { @@ -3230,7 +3234,11 @@ namespace UIKit { } [TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface NSTextContentManagerDelegate { @@ -3560,7 +3568,11 @@ namespace UIKit { interface INSTextViewportLayoutControllerDelegate {} [TV (15,0), NoWatch, Mac (12,0), iOS (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface NSTextViewportLayoutControllerDelegate { @@ -3700,7 +3712,11 @@ namespace UIKit { } [TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface NSTextSelectionDataSource { @@ -3828,7 +3844,11 @@ namespace UIKit { } [TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface NSTextContentStorageDelegate : NSTextContentManagerDelegate { diff --git a/tests/generator/BGenTests.cs b/tests/generator/BGenTests.cs index 12f1443bf6..d445a0dbc4 100644 --- a/tests/generator/BGenTests.cs +++ b/tests/generator/BGenTests.cs @@ -579,7 +579,11 @@ namespace GeneratorTests public void GHIssue3869 () => BuildFile (Profile.iOS, "ghissue3869.cs"); [Test] +#if NET + [TestCase ("issue3875.cs", "api0__Issue3875_AProtocol")] +#else [TestCase ("issue3875.cs", "AProtocol")] +#endif [TestCase ("issue3875B.cs", "BProtocol")] [TestCase ("issue3875C.cs", "api0__Issue3875_AProtocol")] public void Issue3875 (string file, string modelName) diff --git a/tests/generator/issue3875C.cs b/tests/generator/issue3875C.cs index 89ac3a9230..c1481221ef 100644 --- a/tests/generator/issue3875C.cs +++ b/tests/generator/issue3875C.cs @@ -2,7 +2,11 @@ using Foundation; using ObjCRuntime; namespace Issue3875 { +#if NET + [Protocol, Model] +#else [Protocol, Model (AutoGeneratedName = true)] +#endif [BaseType (typeof(NSObject))] interface AProtocol {