diff --git a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj index 34ebaa9faee..6435f0fe56f 100644 --- a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj +++ b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj @@ -65,12 +65,6 @@ armeabi-v7a,x86 true - - Full - False - True - armeabi-v7a,x86 - diff --git a/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj b/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj index e1b9736bab4..09fe8aac06d 100644 --- a/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj +++ b/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj @@ -96,6 +96,9 @@ Entitlements.plist true + + Full + diff --git a/Xamarin.Forms.Platform.iOS/CollectionView/CarouselViewRenderer.cs b/Xamarin.Forms.Platform.iOS/CollectionView/CarouselViewRenderer.cs index 62aafb9d51e..c8eebf58eba 100644 --- a/Xamarin.Forms.Platform.iOS/CollectionView/CarouselViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/CollectionView/CarouselViewRenderer.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Foundation; namespace Xamarin.Forms.Platform.iOS { @@ -6,6 +7,7 @@ public class CarouselViewRenderer : ItemsViewRenderer Element; + [Preserve(Conditional = true)] public CarouselViewRenderer() { CarouselView.VerifyCarouselViewFlagEnabled(nameof(CarouselViewRenderer)); diff --git a/Xamarin.Forms.Platform.iOS/LinkerSafeAttribute.cs b/Xamarin.Forms.Platform.iOS/LinkerSafeAttribute.cs new file mode 100644 index 00000000000..00aff5a7390 --- /dev/null +++ b/Xamarin.Forms.Platform.iOS/LinkerSafeAttribute.cs @@ -0,0 +1,14 @@ +using System; +using System.ComponentModel; + +namespace Xamarin.Forms.Internals +{ + [AttributeUsage(AttributeTargets.All)] + [EditorBrowsable(EditorBrowsableState.Never)] + class LinkerSafeAttribute : Attribute + { + public LinkerSafeAttribute() + { + } + } +} \ No newline at end of file diff --git a/Xamarin.Forms.Platform.iOS/Properties/AssemblyInfo.cs b/Xamarin.Forms.Platform.iOS/Properties/AssemblyInfo.cs index c915edc4b30..9d373106c20 100644 --- a/Xamarin.Forms.Platform.iOS/Properties/AssemblyInfo.cs +++ b/Xamarin.Forms.Platform.iOS/Properties/AssemblyInfo.cs @@ -59,4 +59,4 @@ [assembly: Xamarin.Forms.Dependency(typeof(Deserializer))] [assembly: Xamarin.Forms.Dependency(typeof(ResourcesProvider))] [assembly: ResolutionGroupName("Xamarin")] -[assembly: Preserve] \ No newline at end of file +[assembly: LinkerSafe] \ No newline at end of file diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs index 3ab36a98765..05779f0f5c4 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs @@ -8,6 +8,7 @@ using Xamarin.Forms.PlatformConfiguration.iOSSpecific; using Specifics = Xamarin.Forms.PlatformConfiguration.iOSSpecific; using SizeF = CoreGraphics.CGSize; +using PreserveAttribute = Foundation.PreserveAttribute; namespace Xamarin.Forms.Platform.iOS { @@ -35,6 +36,7 @@ public class ButtonRenderer : ViewRenderer, IImageVisualElemen IImageVisualElementRenderer IButtonLayoutRenderer.ImageVisualElementRenderer => this; nfloat IButtonLayoutRenderer.MinimumHeight => _minimumButtonHeight; + [Preserve(Conditional = true)] public ButtonRenderer() { BorderElementManager.Init(this); diff --git a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs index bada1675062..ca3544c8e18 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs @@ -21,6 +21,7 @@ public class CarouselPageRenderer : UIViewController, IVisualElementRenderer VisualElementTracker _tracker; Page _previousPage; + [Preserve(Conditional = true)] public CarouselPageRenderer() { } diff --git a/Xamarin.Forms.Platform.iOS/Renderers/CheckBoxRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/CheckBoxRenderer.cs index 6d9c95be3e3..63fe0a44faf 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/CheckBoxRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/CheckBoxRenderer.cs @@ -1,9 +1,11 @@ using System; +using Foundation; namespace Xamarin.Forms.Platform.iOS { public class CheckBoxRenderer : CheckBoxRendererBase { + [Preserve(Conditional = true)] public CheckBoxRenderer() { } diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs index 17f15261249..73b9ebf960e 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs @@ -14,6 +14,7 @@ public class EditorRenderer : EditorRendererBase UILabel _placeholderLabel; + [Preserve(Conditional = true)] public EditorRenderer() { Frame = new RectangleF(0, 20, 320, 40); diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs index 1779501c294..b6633678ec8 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs @@ -12,6 +12,7 @@ namespace Xamarin.Forms.Platform.iOS { public class EntryRenderer : EntryRendererBase { + [Preserve(Conditional = true)] public EntryRenderer() { Frame = new RectangleF(0, 20, 320, 40); diff --git a/Xamarin.Forms.Platform.iOS/Renderers/FrameRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/FrameRenderer.cs index 6418d749e7c..f11eb737c61 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/FrameRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/FrameRenderer.cs @@ -2,6 +2,7 @@ using System.Drawing; using CoreAnimation; using CoreGraphics; +using Foundation; using UIKit; namespace Xamarin.Forms.Platform.iOS @@ -88,12 +89,14 @@ public override void LayoutSubviews() base.LayoutSubviews(); } + [Preserve(Conditional = true)] class ShadowView : UIView { CALayer _shadowee; CGRect _previousBounds; CGRect _previousFrame; + [Preserve(Conditional = true)] public ShadowView(CALayer shadowee) { _shadowee = shadowee; diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ImageButtonRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ImageButtonRenderer.cs index 02c69a39538..e2e597e1893 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ImageButtonRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ImageButtonRenderer.cs @@ -22,6 +22,7 @@ public class ImageButtonRenderer : ViewRenderer, IImageVi readonly nfloat _minimumButtonHeight = 44; // Apple docs + [Preserve(Conditional = true)] public ImageButtonRenderer() : base() { ButtonElementManager.Init(this); diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs index 00e7d1377c3..67442829060 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs @@ -8,6 +8,7 @@ using UIKit; using Xamarin.Forms.Internals; using RectangleF = CoreGraphics.CGRect; +using PreserveAttribute = Foundation.PreserveAttribute; namespace Xamarin.Forms.Platform.iOS { @@ -32,6 +33,7 @@ public class ImageRenderer : ViewRenderer, IImageVisual { bool _isDisposed; + [Preserve(Conditional = true)] public ImageRenderer() : base() { ImageElementManager.Init(this); diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs index 3008de67a39..a231f637ea0 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs @@ -34,6 +34,7 @@ public class NavigationRenderer : UINavigationController, IVisualElementRenderer UIImage _defaultNavBarShadowImage; UIImage _defaultNavBarBackImage; + [Preserve(Conditional = true)] public NavigationRenderer() : base(typeof(FormsNavigationBar), null) { MessagingCenter.Subscribe(this, UpdateToolbarButtons, sender => diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs index 41b32162d3c..59427af6f42 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs @@ -30,6 +30,7 @@ public class PageRenderer : UIViewController, IVisualElementRenderer, IEffectCon Thickness _userPadding = default(Thickness); bool _userOverriddenSafeArea = false; + [Preserve(Conditional = true)] public PageRenderer() { } diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs index 1adde8c5e54..a1b6fe05959 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs @@ -28,6 +28,7 @@ public class PhoneMasterDetailRenderer : UIViewController, IVisualElementRendere Page Page => Element as Page; + [Preserve(Conditional = true)] public PhoneMasterDetailRenderer() { } diff --git a/Xamarin.Forms.Platform.iOS/Renderers/RefreshViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/RefreshViewRenderer.cs index cab938d380b..dd73bf3f1bf 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/RefreshViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/RefreshViewRenderer.cs @@ -118,7 +118,7 @@ bool TryOffsetRefresh(UIView view, bool refreshing) return true; } - if (view is UIWebView) + if (view is WkWebViewRenderer) { return true; } @@ -155,7 +155,7 @@ bool TryInsertRefresh(UIView view, int index = 0) return true; } - if (view is UIWebView webView) + if (view is WkWebViewRenderer webView) { webView.ScrollView.InsertSubview(_refreshControl, index); return true; diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs index 2a1b1e9cd90..9594a867a4d 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs @@ -23,6 +23,7 @@ public class ScrollViewRenderer : UIScrollView, IVisualElementRenderer, IEffectC bool _checkedForRtlScroll = false; bool _previousLTR = true; + [Preserve(Conditional = true)] public ScrollViewRenderer() : base(RectangleF.Empty) { ScrollAnimationEnded += HandleScrollAnimationEnded; diff --git a/Xamarin.Forms.Platform.iOS/Renderers/WkWebViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/WkWebViewRenderer.cs index ce8978c81df..ba6b964af5f 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/WkWebViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/WkWebViewRenderer.cs @@ -7,6 +7,7 @@ using UIKit; using WebKit; using Xamarin.Forms.Internals; +using PreserveAttribute = Foundation.PreserveAttribute; using Uri = System.Uri; namespace Xamarin.Forms.Platform.iOS @@ -20,10 +21,15 @@ public class WkWebViewRenderer : WKWebView, IVisualElementRenderer, IWebViewDele #pragma warning disable 0414 VisualElementTracker _tracker; #pragma warning restore 0414 + + + [Preserve(Conditional = true)] public WkWebViewRenderer() : base(RectangleF.Empty, new WKWebViewConfiguration()) { } + + [Preserve(Conditional = true)] public WkWebViewRenderer(WKWebViewConfiguration config) : base(RectangleF.Empty, config) { } diff --git a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj index b80aa909b4a..8175bcecc65 100644 --- a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj +++ b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj @@ -165,6 +165,7 @@ +