[uikit] More linker-friendly `UIControl` (#11872)

The `RemoveTarget` method already checked if `allTargets` was `null`,
even if it was not possible (might have been at some point in time)

It makes some apps, like the one we track for the minimal size, able
to eliminate a few more types (for both _dotnet_ and _legacy_)

```diff
--- a.cs	2021-06-08 17:41:00.000000000 -0400
+++ b.cs	2021-06-08 17:41:02.000000000 -0400
@@ -3216,21 +3216,9 @@
 			NSString.ReleaseNative(intPtr);
 		}
 	}
-	[Register]
-	internal class UIControlEventProxy : NSObject
-	{
-		[MethodImpl(8)]
-		[Export("BridgeSelector")]
-		public void Activated()
-		{
-			throw new NotSupportedException("Linked away");
-		}
-	}
 	[Register("UIControl", true)]
 	public class UIControl : UIView, INativeObject, IDisposable
 	{
-		private static ConditionalWeakTable<UIControl, Dictionary<EventHandler, Dictionary<UIControlEvent, UIControlEventProxy>>> allTargets = new ConditionalWeakTable<UIControl, Dictionary<EventHandler, Dictionary<UIControlEvent, UIControlEventProxy>>>();
-
 		private static readonly IntPtr class_ptr = Class.GetHandle("UIControl");

 		public override IntPtr ClassHandle => class_ptr;
@@ -3523,32 +3511,6 @@
 	}
 	[Flags]
 	[Native]
-	public enum UIControlEvent : ulong
-	{
-		TouchDown = 0x1,
-		TouchDownRepeat = 0x2,
-		TouchDragInside = 0x4,
-		TouchDragOutside = 0x8,
-		TouchDragEnter = 0x10,
-		TouchDragExit = 0x20,
-		TouchUpInside = 0x40,
-		TouchUpOutside = 0x80,
-		TouchCancel = 0x100,
-		ValueChanged = 0x1000,
-		PrimaryActionTriggered = 0x2000,
-		MenuActionTriggered = 0x4000,
-		EditingDidBegin = 0x10000,
-		EditingChanged = 0x20000,
-		EditingDidEnd = 0x40000,
-		EditingDidEndOnExit = 0x80000,
-		AllTouchEvents = 0xFFF,
-		AllEditingEvents = 0xF0000,
-		ApplicationReserved = 0xF000000,
-		SystemReserved = 0xF0000000,
-		AllEvents = 0xFFFFFFFF
-	}
-	[Flags]
-	[Native]
 	public enum UIControlState : ulong
 	{
 		Normal = 0x0,
@@ -4737,10 +4699,6 @@

 		public bool IsWrapper => is_wrapper;

-		public RegisterAttribute()
-		{
-		}
-
 		public RegisterAttribute(string P_0)
 		{
 			name = P_0;
```
This commit is contained in:
Sebastien Pouliot 2021-06-09 08:50:14 -04:00 коммит произвёл GitHub
Родитель c79f1d626c
Коммит fe49e3a112
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 4 добавлений и 2 удалений

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

@ -47,10 +47,12 @@ namespace UIKit {
}
public partial class UIControl {
static ConditionalWeakTable<UIControl,Dictionary<EventHandler, Dictionary<UIControlEvent, UIControlEventProxy>>> allTargets = new
ConditionalWeakTable<UIControl,Dictionary<EventHandler, Dictionary<UIControlEvent, UIControlEventProxy>>> ();
static ConditionalWeakTable<UIControl,Dictionary<EventHandler, Dictionary<UIControlEvent, UIControlEventProxy>>> allTargets;
public void AddTarget (EventHandler notification, UIControlEvent events)
{
if (allTargets == null)
allTargets = new ();
var targets = allTargets.GetValue (this, k =>
{
MarkDirty ();