public void Add(IView child) { _ = TypedNativeView ?? throw new InvalidOperationException($"{nameof(TypedNativeView)} should have been set by base class."); _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); TypedNativeView.AddSubview(child.ToNative()); TypedNativeView.SetNeedsLayout(); }
public void Add(IView child) { _ = TypedNativeView ?? throw new InvalidOperationException($"{nameof(TypedNativeView)} should have been set by base class."); _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); _ = MauiApp.Current?.Context ?? throw new InvalidOperationException($"The MauiApp.Current.Context can't be null."); TypedNativeView.AddSubview(child.ToNative(MauiApp.Current.Context)); TypedNativeView.SetNeedsLayout(); }
public void Remove(IView child) { _ = TypedNativeView ?? throw new InvalidOperationException($"{nameof(TypedNativeView)} should have been set by base class."); _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); if (child?.Handler?.NativeView is NativeView nativeView) { nativeView.RemoveFromSuperview(); TypedNativeView.SetNeedsLayout(); } }