summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS/ExportRendererAttribute.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/ExportRendererAttribute.cs')
-rw-r--r--Xamarin.Forms.Platform.iOS/ExportRendererAttribute.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.iOS/ExportRendererAttribute.cs b/Xamarin.Forms.Platform.iOS/ExportRendererAttribute.cs
new file mode 100644
index 00000000..50bba17f
--- /dev/null
+++ b/Xamarin.Forms.Platform.iOS/ExportRendererAttribute.cs
@@ -0,0 +1,29 @@
+using System;
+using UIKit;
+
+namespace Xamarin.Forms
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
+ public sealed class ExportRendererAttribute : HandlerAttribute
+ {
+ public ExportRendererAttribute(Type handler, Type target, UIUserInterfaceIdiom idiom) : base(handler, target)
+ {
+ Idiomatic = true;
+ Idiom = idiom;
+ }
+
+ public ExportRendererAttribute(Type handler, Type target) : base(handler, target)
+ {
+ Idiomatic = false;
+ }
+
+ internal UIUserInterfaceIdiom Idiom { get; }
+
+ internal bool Idiomatic { get; }
+
+ public override bool ShouldRegister()
+ {
+ return !Idiomatic || Idiom == UIDevice.CurrentDevice.UserInterfaceIdiom;
+ }
+ }
+} \ No newline at end of file