summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS/Renderers/ExportRendererAttribute.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/ExportRendererAttribute.cs')
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ExportRendererAttribute.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ExportRendererAttribute.cs b/Xamarin.Forms.Platform.iOS/Renderers/ExportRendererAttribute.cs
new file mode 100644
index 00000000..899056da
--- /dev/null
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ExportRendererAttribute.cs
@@ -0,0 +1,30 @@
+using System;
+#if __UNIFIED__
+using UIKit;
+#else
+using MonoTouch.UIKit;
+#endif
+
+namespace Xamarin.Forms
+{
+ [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)]
+ public sealed class ExportRendererAttribute : HandlerAttribute {
+ internal bool Idiomatic { get; private set; }
+ internal UIUserInterfaceIdiom Idiom { get; private set; }
+
+ 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;
+ }
+
+ public override bool ShouldRegister () {
+ return !Idiomatic || Idiom == UIDevice.CurrentDevice.UserInterfaceIdiom;
+ }
+ }
+} \ No newline at end of file