iOS: Eliminate fml::scoped_nsobject pointer use (#56295)

Eliminates use of `fml::scoped_nsobject` now that the codebase has been migrated to ARC.

Issue: https://github.com/flutter/flutter/issues/137801

No changes to tests since this patch makes no semantic changes.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
diff --git a/shell/gpu/gpu_surface_metal_impeller.h b/shell/gpu/gpu_surface_metal_impeller.h
index 5aebb87..9236e91 100644
--- a/shell/gpu/gpu_surface_metal_impeller.h
+++ b/shell/gpu/gpu_surface_metal_impeller.h
@@ -9,7 +9,6 @@
 
 #include "flutter/flow/surface.h"
 #include "flutter/fml/macros.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "flutter/impeller/display_list/aiks_context.h"
 #include "flutter/impeller/renderer/backend/metal/context_mtl.h"
 #include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
diff --git a/shell/gpu/gpu_surface_metal_skia.mm b/shell/gpu/gpu_surface_metal_skia.mm
index 9a22c21..111c5b2 100644
--- a/shell/gpu/gpu_surface_metal_skia.mm
+++ b/shell/gpu/gpu_surface_metal_skia.mm
@@ -15,7 +15,6 @@
 #include "flutter/common/graphics/persistent_cache.h"
 #include "flutter/fml/make_copyable.h"
 #include "flutter/fml/platform/darwin/cf_utils.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "flutter/fml/trace_event.h"
 #include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
 #include "third_party/skia/include/core/SkCanvas.h"
diff --git a/shell/platform/darwin/common/buffer_conversions.mm b/shell/platform/darwin/common/buffer_conversions.mm
index 749f35a..6a44c2c 100644
--- a/shell/platform/darwin/common/buffer_conversions.mm
+++ b/shell/platform/darwin/common/buffer_conversions.mm
@@ -5,7 +5,6 @@
 #import "flutter/shell/platform/darwin/common/buffer_conversions.h"
 
 #include "flutter/fml/macros.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 
 static_assert(__has_feature(objc_arc), "ARC must be enabled.");
 
diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm
index 597bc5b..690d8c1 100644
--- a/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm
+++ b/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm
@@ -41,7 +41,6 @@
 
 #include "flutter/fml/logging.h"
 #include "flutter/fml/message_loop.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "flutter/runtime/dart_service_isolate.h"
 #import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
 
diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
index b42c267..7a611d8 100644
--- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
+++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
@@ -14,7 +14,6 @@
 
 #include "flutter/flow/surface.h"
 #include "flutter/fml/memory/weak_ptr.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "flutter/fml/trace_event.h"
 #import "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"
 #import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h"
diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
index d249d44..bd0edd7 100644
--- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
+++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
@@ -714,7 +714,7 @@
   // This gesture recognizer retains the `FlutterViewController` until the
   // end of a gesture sequence, that is all the touches in touchesBegan are concluded
   // with |touchesCancelled| or |touchesEnded|.
-  fml::scoped_nsobject<UIViewController<FlutterViewResponder>> _flutterViewController;
+  UIViewController<FlutterViewResponder>* _flutterViewController;
 }
 
 - (instancetype)initWithTarget:(id)target
@@ -741,18 +741,18 @@
     // At the start of each gesture sequence, we reset the `_flutterViewController`,
     // so that all the touch events in the same sequence are forwarded to the same
     // `_flutterViewController`.
-    _flutterViewController.reset(_platformViewsController->GetFlutterViewController());
+    _flutterViewController = _platformViewsController->GetFlutterViewController();
   }
-  [_flutterViewController.get() touchesBegan:touches withEvent:event];
+  [_flutterViewController touchesBegan:touches withEvent:event];
   _currentTouchPointersCount += touches.count;
 }
 
 - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
-  [_flutterViewController.get() touchesMoved:touches withEvent:event];
+  [_flutterViewController touchesMoved:touches withEvent:event];
 }
 
 - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
-  [_flutterViewController.get() touchesEnded:touches withEvent:event];
+  [_flutterViewController touchesEnded:touches withEvent:event];
   _currentTouchPointersCount -= touches.count;
   // Touches in one touch sequence are sent to the touchesEnded method separately if different
   // fingers stop touching the screen at different time. So one touchesEnded method triggering does
@@ -760,7 +760,7 @@
   // UIGestureRecognizerStateFailed when all the touches in the current touch sequence is ended.
   if (_currentTouchPointersCount == 0) {
     self.state = UIGestureRecognizerStateFailed;
-    _flutterViewController.reset(nil);
+    _flutterViewController = nil;
     [self forceResetStateIfNeeded];
   }
 }
@@ -771,11 +771,11 @@
   // Flutter needs all the cancelled touches to be "cancelled" change types in order to correctly
   // handle gesture sequence.
   // We always override the change type to "cancelled".
-  [_flutterViewController.get() forceTouchesCancelled:touches];
+  [_flutterViewController forceTouchesCancelled:touches];
   _currentTouchPointersCount -= touches.count;
   if (_currentTouchPointersCount == 0) {
     self.state = UIGestureRecognizerStateFailed;
-    _flutterViewController.reset(nil);
+    _flutterViewController = nil;
     [self forceResetStateIfNeeded];
   }
 }
diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h
index 787da4d..ffbd8e4 100644
--- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h
+++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h
@@ -14,7 +14,6 @@
 
 #include "flutter/fml/macros.h"
 #include "flutter/fml/memory/weak_ptr.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "flutter/lib/ui/semantics/custom_accessibility_action.h"
 #include "flutter/lib/ui/semantics/semantics_node.h"
 #import "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"
@@ -98,10 +97,8 @@
   // (i.e. the status bar or keyboard)
   int32_t last_focused_semantics_object_id_;
 
-  // TODO(cbracken): https://github.com/flutter/flutter/issues/137801
-  // Eliminate use of fml::scoped_* wrappers here.
-  fml::scoped_nsobject<NSMutableDictionary<NSNumber*, SemanticsObject*>> objects_;
-  fml::scoped_nsprotocol<FlutterBasicMessageChannel*> accessibility_channel_;
+  NSMutableDictionary<NSNumber*, SemanticsObject*>* objects_;
+  FlutterBasicMessageChannel* accessibility_channel_;
   int32_t previous_route_id_ = 0;
   std::unordered_map<int32_t, flutter::CustomAccessibilityAction> actions_;
   std::vector<int32_t> previous_routes_;
diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm
index 56f9da5..62467d3 100644
--- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm
+++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm
@@ -53,17 +53,17 @@
       ios_delegate_(ios_delegate ? std::move(ios_delegate)
                                  : std::make_unique<DefaultIosDelegate>()),
       weak_factory_(this) {
-  accessibility_channel_.reset([[FlutterBasicMessageChannel alloc]
+  accessibility_channel_ = [[FlutterBasicMessageChannel alloc]
          initWithName:@"flutter/accessibility"
       binaryMessenger:platform_view->GetOwnerViewController().engine.binaryMessenger
-                codec:[FlutterStandardMessageCodec sharedInstance]]);
-  [accessibility_channel_.get() setMessageHandler:^(id message, FlutterReply reply) {
+                codec:[FlutterStandardMessageCodec sharedInstance]];
+  [accessibility_channel_ setMessageHandler:^(id message, FlutterReply reply) {
     HandleEvent((NSDictionary*)message);
   }];
 }
 
 AccessibilityBridge::~AccessibilityBridge() {
-  [accessibility_channel_.get() setMessageHandler:nil];
+  [accessibility_channel_ setMessageHandler:nil];
   clearState();
   view_controller_.viewIfLoaded.accessibilityElements = nil;
 }
@@ -74,7 +74,7 @@
 
 void AccessibilityBridge::AccessibilityObjectDidBecomeFocused(int32_t id) {
   last_focused_semantics_object_id_ = id;
-  [accessibility_channel_.get() sendMessage:@{@"type" : @"didGainFocus", @"nodeId" : @(id)}];
+  [accessibility_channel_ sendMessage:@{@"type" : @"didGainFocus", @"nodeId" : @(id)}];
 }
 
 void AccessibilityBridge::AccessibilityObjectDidLoseFocus(int32_t id) {
@@ -152,7 +152,7 @@
     }
   }
 
-  SemanticsObject* root = objects_.get()[@(kRootNodeId)];
+  SemanticsObject* root = objects_[@(kRootNodeId)];
 
   bool routeChanged = false;
   SemanticsObject* lastAdded = nil;
@@ -196,13 +196,13 @@
     view_controller_.viewIfLoaded.accessibilityElements = nil;
   }
 
-  NSMutableArray<NSNumber*>* doomed_uids = [NSMutableArray arrayWithArray:[objects_ allKeys]];
+  NSMutableArray<NSNumber*>* doomed_uids = [NSMutableArray arrayWithArray:objects_.allKeys];
   if (root) {
     VisitObjectsRecursivelyAndRemove(root, doomed_uids);
   }
   [objects_ removeObjectsForKeys:doomed_uids];
 
-  for (SemanticsObject* object in [objects_ allValues]) {
+  for (SemanticsObject* object in objects_.allValues) {
     [object accessibilityBridgeDidFinishUpdate];
   }
 
@@ -217,8 +217,7 @@
 
     if (layoutChanged) {
       SemanticsObject* next = FindNextFocusableIfNecessary();
-      SemanticsObject* lastFocused =
-          [objects_.get() objectForKey:@(last_focused_semantics_object_id_)];
+      SemanticsObject* lastFocused = [objects_ objectForKey:@(last_focused_semantics_object_id_)];
       // Only specify the focus item if the new focus is different, avoiding double focuses on the
       // same item. See: https://github.com/flutter/flutter/issues/104176. If there is a route
       // change, we always refocus.
@@ -290,10 +289,10 @@
 
 SemanticsObject* AccessibilityBridge::GetOrCreateObject(int32_t uid,
                                                         flutter::SemanticsNodeUpdates& updates) {
-  SemanticsObject* object = objects_.get()[@(uid)];
+  SemanticsObject* object = objects_[@(uid)];
   if (!object) {
     object = CreateObject(updates[uid], GetWeakPtr());
-    objects_.get()[@(uid)] = object;
+    objects_[@(uid)] = object;
   } else {
     // Existing node case
     auto nodeEntry = updates.find(object.node.id);
@@ -309,7 +308,7 @@
         // SemanticsObject implementation. Instead, we replace it with a new
         // instance.
         SemanticsObject* newSemanticsObject = CreateObject(node, GetWeakPtr());
-        ReplaceSemanticsObject(object, newSemanticsObject, objects_.get());
+        ReplaceSemanticsObject(object, newSemanticsObject, objects_);
         object = newSemanticsObject;
       }
     }
@@ -332,11 +331,11 @@
   }
 
   // Tries to refocus the previous focused semantics object to avoid random jumps.
-  return FindFirstFocusable([objects_.get() objectForKey:@(last_focused_semantics_object_id_)]);
+  return FindFirstFocusable(objects_[@(last_focused_semantics_object_id_)]);
 }
 
 SemanticsObject* AccessibilityBridge::FindFirstFocusable(SemanticsObject* parent) {
-  SemanticsObject* currentObject = parent ?: objects_.get()[@(kRootNodeId)];
+  SemanticsObject* currentObject = parent ?: objects_[@(kRootNodeId)];
   if (!currentObject) {
     return nil;
   }
@@ -360,7 +359,7 @@
     ios_delegate_->PostAccessibilityNotification(UIAccessibilityAnnouncementNotification, message);
   }
   if ([type isEqualToString:@"focus"]) {
-    SemanticsObject* node = objects_.get()[annotatedEvent[@"nodeId"]];
+    SemanticsObject* node = objects_[annotatedEvent[@"nodeId"]];
     ios_delegate_->PostAccessibilityNotification(UIAccessibilityLayoutChangedNotification, node);
   }
 }
diff --git a/shell/platform/darwin/ios/framework/Source/overlay_layer_pool.h b/shell/platform/darwin/ios/framework/Source/overlay_layer_pool.h
index bd04aa8..530dc78 100644
--- a/shell/platform/darwin/ios/framework/Source/overlay_layer_pool.h
+++ b/shell/platform/darwin/ios/framework/Source/overlay_layer_pool.h
@@ -11,7 +11,6 @@
 #import <UIKit/UIKit.h>
 
 #include "flow/surface.h"
-#include "fml/platform/darwin/scoped_nsobject.h"
 
 #import "flutter/shell/platform/darwin/ios/ios_context.h"
 
@@ -21,15 +20,15 @@
 
 /// @brief State holder for a Flutter overlay layer.
 struct OverlayLayer {
-  OverlayLayer(const fml::scoped_nsobject<UIView>& overlay_view,
-               const fml::scoped_nsobject<UIView>& overlay_view_wrapper,
+  OverlayLayer(UIView* overlay_view,
+               UIView* overlay_view_wrapper,
                std::unique_ptr<IOSSurface> ios_surface,
                std::unique_ptr<Surface> surface);
 
   ~OverlayLayer() = default;
 
-  fml::scoped_nsobject<UIView> overlay_view;
-  fml::scoped_nsobject<UIView> overlay_view_wrapper;
+  UIView* overlay_view;
+  UIView* overlay_view_wrapper;
   std::unique_ptr<IOSSurface> ios_surface;
   std::unique_ptr<Surface> surface;
 
diff --git a/shell/platform/darwin/ios/framework/Source/overlay_layer_pool.mm b/shell/platform/darwin/ios/framework/Source/overlay_layer_pool.mm
index 4d63a59..ee409b7 100644
--- a/shell/platform/darwin/ios/framework/Source/overlay_layer_pool.mm
+++ b/shell/platform/darwin/ios/framework/Source/overlay_layer_pool.mm
@@ -9,8 +9,8 @@
 
 namespace flutter {
 
-OverlayLayer::OverlayLayer(const fml::scoped_nsobject<UIView>& overlay_view,
-                           const fml::scoped_nsobject<UIView>& overlay_view_wrapper,
+OverlayLayer::OverlayLayer(UIView* overlay_view,
+                           UIView* overlay_view_wrapper,
                            std::unique_ptr<IOSSurface> ios_surface,
                            std::unique_ptr<Surface> surface)
     : overlay_view(overlay_view),
@@ -22,7 +22,6 @@
                                    SkRect rect,
                                    int64_t view_id,
                                    int64_t overlay_id) {
-  UIView* overlay_view_wrapper = this->overlay_view_wrapper.get();
   auto screenScale = [UIScreen mainScreen].scale;
   // Set the size of the overlay view wrapper.
   // This wrapper view masks the overlay view.
@@ -32,7 +31,6 @@
   overlay_view_wrapper.accessibilityIdentifier =
       [NSString stringWithFormat:@"platform_view[%lld].overlay[%lld]", view_id, overlay_id];
 
-  UIView* overlay_view = this->overlay_view.get();
   // Set the size of the overlay view.
   // This size is equal to the device screen size.
   overlay_view.frame = [flutter_view convertRect:flutter_view.bounds toView:overlay_view_wrapper];
@@ -59,32 +57,32 @@
                                    MTLPixelFormat pixel_format) {
   FML_DCHECK([[NSThread currentThread] isMainThread]);
   std::shared_ptr<OverlayLayer> layer;
-  fml::scoped_nsobject<UIView> overlay_view;
-  fml::scoped_nsobject<UIView> overlay_view_wrapper;
+  UIView* overlay_view;
+  UIView* overlay_view_wrapper;
 
   bool impeller_enabled = !!ios_context->GetImpellerContext();
   if (!gr_context && !impeller_enabled) {
-    overlay_view.reset([[FlutterOverlayView alloc] init]);
-    overlay_view_wrapper.reset([[FlutterOverlayView alloc] init]);
+    overlay_view = [[FlutterOverlayView alloc] init];
+    overlay_view_wrapper = [[FlutterOverlayView alloc] init];
 
-    auto ca_layer = fml::scoped_nsobject<CALayer>{[overlay_view.get() layer]};
+    CALayer* ca_layer = overlay_view.layer;
     std::unique_ptr<IOSSurface> ios_surface = IOSSurface::Create(ios_context, ca_layer);
     std::unique_ptr<Surface> surface = ios_surface->CreateGPUSurface();
 
-    layer = std::make_shared<OverlayLayer>(std::move(overlay_view), std::move(overlay_view_wrapper),
+    layer = std::make_shared<OverlayLayer>(overlay_view, overlay_view_wrapper,
                                            std::move(ios_surface), std::move(surface));
   } else {
     CGFloat screenScale = [UIScreen mainScreen].scale;
-    overlay_view.reset([[FlutterOverlayView alloc] initWithContentsScale:screenScale
-                                                             pixelFormat:pixel_format]);
-    overlay_view_wrapper.reset([[FlutterOverlayView alloc] initWithContentsScale:screenScale
-                                                                     pixelFormat:pixel_format]);
+    overlay_view = [[FlutterOverlayView alloc] initWithContentsScale:screenScale
+                                                         pixelFormat:pixel_format];
+    overlay_view_wrapper = [[FlutterOverlayView alloc] initWithContentsScale:screenScale
+                                                                 pixelFormat:pixel_format];
 
-    auto ca_layer = fml::scoped_nsobject<CALayer>{[overlay_view.get() layer]};
+    CALayer* ca_layer = overlay_view.layer;
     std::unique_ptr<IOSSurface> ios_surface = IOSSurface::Create(ios_context, ca_layer);
     std::unique_ptr<Surface> surface = ios_surface->CreateGPUSurface(gr_context);
 
-    layer = std::make_shared<OverlayLayer>(std::move(overlay_view), std::move(overlay_view_wrapper),
+    layer = std::make_shared<OverlayLayer>(overlay_view, overlay_view_wrapper,
                                            std::move(ios_surface), std::move(surface));
     layer->gr_context = gr_context;
   }
@@ -102,8 +100,8 @@
   // |    |    wrapper   |    |  == mask =>  | overlay_view |
   // |    +--------------+    |              +--------------+
   // +------------------------+
-  layer->overlay_view_wrapper.get().clipsToBounds = YES;
-  [layer->overlay_view_wrapper.get() addSubview:layer->overlay_view];
+  layer->overlay_view_wrapper.clipsToBounds = YES;
+  [layer->overlay_view_wrapper addSubview:layer->overlay_view];
 
   layers_.push_back(layer);
 }
diff --git a/shell/platform/darwin/ios/framework/Source/platform_views_controller.h b/shell/platform/darwin/ios/framework/Source/platform_views_controller.h
index 217a6e2..623ab46 100644
--- a/shell/platform/darwin/ios/framework/Source/platform_views_controller.h
+++ b/shell/platform/darwin/ios/framework/Source/platform_views_controller.h
@@ -11,7 +11,6 @@
 
 #include "flutter/flow/surface.h"
 #include "flutter/fml/memory/weak_ptr.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "flutter/fml/task_runner.h"
 #include "flutter/fml/trace_event.h"
 #include "impeller/base/thread_safety.h"
@@ -242,12 +241,10 @@
   // The Slices are deleted by the PlatformViewsController.reset().
   std::unordered_map<int64_t, std::unique_ptr<EmbedderViewSlice>> slices_;
 
-  fml::scoped_nsobject<FlutterMethodChannel> channel_;
-  fml::scoped_nsobject<UIView> flutter_view_;
-  fml::scoped_nsobject<UIViewController<FlutterViewResponder>> flutter_view_controller_;
-  fml::scoped_nsobject<FlutterClippingMaskViewPool> mask_view_pool_;
-  std::unordered_map<std::string, fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>>
-      factories_;
+  UIView* flutter_view_;
+  UIViewController<FlutterViewResponder>* flutter_view_controller_;
+  FlutterClippingMaskViewPool* mask_view_pool_;
+  std::unordered_map<std::string, NSObject<FlutterPlatformViewFactory>*> factories_;
 
   // The FlutterPlatformViewGestureRecognizersBlockingPolicy for each type of platform view.
   std::unordered_map<std::string, FlutterPlatformViewGestureRecognizersBlockingPolicy>
@@ -264,9 +261,9 @@
   ///
   /// This data must only be accessed on the platform thread.
   struct PlatformViewData {
-    fml::scoped_nsobject<NSObject<FlutterPlatformView>> view;
-    fml::scoped_nsobject<FlutterTouchInterceptingView> touch_interceptor;
-    fml::scoped_nsobject<UIView> root_view;
+    NSObject<FlutterPlatformView>* view;
+    FlutterTouchInterceptingView* touch_interceptor;
+    UIView* root_view;
   };
 
   /// This data must only be accessed on the platform thread.
diff --git a/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm b/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm
index 7f8a732..b14e8f0 100644
--- a/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm
+++ b/shell/platform/darwin/ios/framework/Source/platform_views_controller.mm
@@ -113,8 +113,8 @@
 PlatformViewsController::PlatformViewsController()
     : layer_pool_(std::make_unique<OverlayLayerPool>()),
       weak_factory_(std::make_unique<fml::WeakPtrFactory<PlatformViewsController>>(this)) {
-  mask_view_pool_.reset(
-      [[FlutterClippingMaskViewPool alloc] initWithCapacity:kFlutterClippingMaskViewPoolCapacity]);
+  mask_view_pool_ =
+      [[FlutterClippingMaskViewPool alloc] initWithCapacity:kFlutterClippingMaskViewPoolCapacity];
 };
 
 void PlatformViewsController::SetTaskRunner(
@@ -127,16 +127,16 @@
 }
 
 void PlatformViewsController::SetFlutterView(UIView* flutter_view) {
-  flutter_view_.reset(flutter_view);
+  flutter_view_ = flutter_view;
 }
 
 void PlatformViewsController::SetFlutterViewController(
     UIViewController<FlutterViewResponder>* flutter_view_controller) {
-  flutter_view_controller_.reset(flutter_view_controller);
+  flutter_view_controller_ = flutter_view_controller;
 }
 
 UIViewController<FlutterViewResponder>* PlatformViewsController::GetFlutterViewController() {
-  return flutter_view_controller_.get();
+  return flutter_view_controller_;
 }
 
 void PlatformViewsController::OnMethodCall(FlutterMethodCall* call, FlutterResult result) {
@@ -167,7 +167,7 @@
     return;
   }
 
-  NSObject<FlutterPlatformViewFactory>* factory = factories_[viewType].get();
+  NSObject<FlutterPlatformViewFactory>* factory = factories_[viewType];
   if (factory == nil) {
     result([FlutterError
         errorWithCode:@"unregistered_view_type"
@@ -209,13 +209,11 @@
   ChildClippingView* clipping_view = [[ChildClippingView alloc] initWithFrame:CGRectZero];
   [clipping_view addSubview:touch_interceptor];
 
-  platform_views_.emplace(
-      viewId, PlatformViewData{
-                  .view = fml::scoped_nsobject<NSObject<FlutterPlatformView>>(embedded_view),  //
-                  .touch_interceptor =
-                      fml::scoped_nsobject<FlutterTouchInterceptingView>(touch_interceptor),  //
-                  .root_view = fml::scoped_nsobject<UIView>(clipping_view)                    //
-              });
+  platform_views_.emplace(viewId, PlatformViewData{
+                                      .view = embedded_view,                   //
+                                      .touch_interceptor = touch_interceptor,  //
+                                      .root_view = clipping_view               //
+                                  });
 
   result(nil);
 }
@@ -246,7 +244,7 @@
     return;
   }
 
-  FlutterTouchInterceptingView* view = platform_views_[viewId].touch_interceptor.get();
+  FlutterTouchInterceptingView* view = platform_views_[viewId].touch_interceptor;
   [view releaseGesture];
 
   result(nil);
@@ -263,7 +261,7 @@
     return;
   }
 
-  FlutterTouchInterceptingView* view = platform_views_[viewId].touch_interceptor.get();
+  FlutterTouchInterceptingView* view = platform_views_[viewId].touch_interceptor;
   [view blockGesture];
 
   result(nil);
@@ -275,7 +273,7 @@
     FlutterPlatformViewGestureRecognizersBlockingPolicy gestureRecognizerBlockingPolicy) {
   std::string idString([factoryId UTF8String]);
   FML_CHECK(factories_.count(idString) == 0);
-  factories_[idString] = fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>(factory);
+  factories_[idString] = factory;
   gesture_recognizers_blocking_policies_[idString] = gestureRecognizerBlockingPolicy;
 }
 
@@ -383,12 +381,12 @@
   if (platform_views_.empty()) {
     return nil;
   }
-  return platform_views_[view_id].touch_interceptor.get();
+  return platform_views_[view_id].touch_interceptor;
 }
 
 long PlatformViewsController::FindFirstResponderPlatformViewId() {
   for (auto const& [id, platform_view_data] : platform_views_) {
-    UIView* root_view = (UIView*)platform_view_data.root_view.get();
+    UIView* root_view = platform_view_data.root_view;
     if (root_view.flt_hasFirstResponderInViewHierarchySubtree) {
       return id;
     }
@@ -401,11 +399,10 @@
   if (clipView.maskView) {
     return;
   }
-  UIView* flutterView = flutter_view_.get();
   CGRect frame =
       CGRectMake(-clipView.frame.origin.x, -clipView.frame.origin.y,
-                 CGRectGetWidth(flutterView.bounds), CGRectGetHeight(flutterView.bounds));
-  clipView.maskView = [mask_view_pool_.get() getMaskViewWithFrame:frame];
+                 CGRectGetWidth(flutter_view_.bounds), CGRectGetHeight(flutter_view_.bounds));
+  clipView.maskView = [mask_view_pool_ getMaskViewWithFrame:frame];
 }
 
 // This method is only called when the `embedded_view` needs to be re-composited at the current
@@ -425,7 +422,7 @@
   FML_DCHECK(!clipView.maskView ||
              [clipView.maskView isKindOfClass:[FlutterClippingMaskView class]]);
   if (clipView.maskView) {
-    [mask_view_pool_.get() insertViewToPoolIfNeeded:(FlutterClippingMaskView*)(clipView.maskView)];
+    [mask_view_pool_ insertViewToPoolIfNeeded:(FlutterClippingMaskView*)(clipView.maskView)];
     clipView.maskView = nil;
   }
   CGFloat screenScale = [UIScreen mainScreen].scale;
@@ -484,7 +481,7 @@
           break;
         }
         CGRect intersection = CGRectIntersection(filterRect, clipView.frame);
-        CGRect frameInClipView = [flutter_view_.get() convertRect:intersection toView:clipView];
+        CGRect frameInClipView = [flutter_view_ convertRect:intersection toView:clipView];
         // sigma_x is arbitrarily chosen as the radius value because Quartz sets
         // sigma_x and sigma_y equal to each other. DlBlurImageFilter's Tile Mode
         // is not supported in Quartz's gaussianBlur CAFilter, so it is not used
@@ -540,7 +537,7 @@
 void PlatformViewsController::CompositeWithParams(int64_t view_id,
                                                   const EmbeddedViewParams& params) {
   CGRect frame = CGRectMake(0, 0, params.sizePoints().width(), params.sizePoints().height());
-  FlutterTouchInterceptingView* touchInterceptor = platform_views_[view_id].touch_interceptor.get();
+  FlutterTouchInterceptingView* touchInterceptor = platform_views_[view_id].touch_interceptor;
 #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG
   FML_DCHECK(CGPointEqualToPoint([touchInterceptor embeddedView].frame.origin, CGPointZero));
   if (non_zero_origin_views_.find(view_id) == non_zero_origin_views_.end() &&
@@ -564,7 +561,7 @@
   touchInterceptor.alpha = 1;
 
   const MutatorsStack& mutatorStack = params.mutatorsStack();
-  UIView* clippingView = platform_views_[view_id].root_view.get();
+  UIView* clippingView = platform_views_[view_id].root_view;
   // The frame of the clipping view should be the final bounding rect.
   // Because the translate matrix in the Mutator Stack also includes the offset,
   // when we apply the transforms matrix in |ApplyMutators|, we need
@@ -584,13 +581,13 @@
   // Reset will only be called from the raster thread or a merged raster/platform thread.
   // platform_views_ must only be modified on the platform thread, and any operations that
   // read or modify platform views should occur there.
-  fml::TaskRunner::RunNowOrPostTask(
-      platform_task_runner_, [&, composition_order = composition_order_]() {
-        for (int64_t view_id : composition_order_) {
-          [platform_views_[view_id].root_view.get() removeFromSuperview];
-        }
-        platform_views_.clear();
-      });
+  fml::TaskRunner::RunNowOrPostTask(platform_task_runner_,
+                                    [&, composition_order = composition_order_]() {
+                                      for (int64_t view_id : composition_order_) {
+                                        [platform_views_[view_id].root_view removeFromSuperview];
+                                      }
+                                      platform_views_.clear();
+                                    });
 
   composition_order_.clear();
   slices_.clear();
@@ -729,9 +726,9 @@
   auto latch = std::make_shared<fml::CountDownLatch>(1u);
   fml::TaskRunner::RunNowOrPostTask(platform_task_runner_, [&]() {
     for (auto i = 0u; i < missing_layer_count; i++) {
-      CreateLayer(gr_context,                                      //
-                  ios_context,                                     //
-                  ((FlutterView*)flutter_view_.get()).pixelFormat  //
+      CreateLayer(gr_context,                                //
+                  ios_context,                               //
+                  ((FlutterView*)flutter_view_).pixelFormat  //
       );
     }
     latch->CountDown();
@@ -791,12 +788,12 @@
 void PlatformViewsController::BringLayersIntoView(const LayersMap& layer_map,
                                                   const std::vector<int64_t>& composition_order) {
   FML_DCHECK(flutter_view_);
-  UIView* flutter_view = flutter_view_.get();
+  UIView* flutter_view = flutter_view_;
 
   previous_composition_order_.clear();
   NSMutableArray* desired_platform_subviews = [NSMutableArray array];
   for (int64_t platform_view_id : composition_order) {
-    UIView* platform_view_root = platform_views_[platform_view_id].root_view.get();
+    UIView* platform_view_root = platform_views_[platform_view_id].root_view;
     if (platform_view_root != nil) {
       [desired_platform_subviews addObject:platform_view_root];
     }
@@ -854,7 +851,7 @@
   // Remove unused platform views.
   for (int64_t view_id : previous_composition_order_) {
     if (composition_order_set.find(view_id) == composition_order_set.end()) {
-      UIView* platform_view_root = platform_views_[view_id].root_view.get();
+      UIView* platform_view_root = platform_views_[view_id].root_view;
       [platform_view_root removeFromSuperview];
     }
   }
@@ -874,7 +871,7 @@
       views_to_delay_dispose.insert(viewId);
       continue;
     }
-    UIView* root_view = platform_views_[viewId].root_view.get();
+    UIView* root_view = platform_views_[viewId].root_view;
     views.push_back(root_view);
     current_composition_params_.erase(viewId);
     views_to_recomposite_.erase(viewId);
diff --git a/shell/platform/darwin/ios/ios_context.h b/shell/platform/darwin/ios/ios_context.h
index b68c89e..a1ab361 100644
--- a/shell/platform/darwin/ios/ios_context.h
+++ b/shell/platform/darwin/ios/ios_context.h
@@ -11,7 +11,6 @@
 #include "flutter/common/graphics/texture.h"
 #include "flutter/fml/concurrent_message_loop.h"
 #include "flutter/fml/macros.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "flutter/fml/synchronization/sync_switch.h"
 #import "flutter/shell/platform/darwin/common/framework/Headers/FlutterTexture.h"
 #import "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
@@ -121,9 +120,8 @@
   /// @return     The texture proxy if the rendering backend supports embedder
   ///             provided external textures.
   ///
-  virtual std::unique_ptr<Texture> CreateExternalTexture(
-      int64_t texture_id,
-      fml::scoped_nsobject<NSObject<FlutterTexture>> texture) = 0;
+  virtual std::unique_ptr<Texture> CreateExternalTexture(int64_t texture_id,
+                                                         NSObject<FlutterTexture>* texture) = 0;
 
   //----------------------------------------------------------------------------
   /// @brief      Accessor for the Skia context associated with IOSSurfaces and
diff --git a/shell/platform/darwin/ios/ios_context_metal_impeller.h b/shell/platform/darwin/ios/ios_context_metal_impeller.h
index 4838bfe..c3edc7c 100644
--- a/shell/platform/darwin/ios/ios_context_metal_impeller.h
+++ b/shell/platform/darwin/ios/ios_context_metal_impeller.h
@@ -34,7 +34,7 @@
   sk_sp<GrDirectContext> GetResourceContext() const;
 
  private:
-  fml::scoped_nsobject<FlutterDarwinContextMetalImpeller> darwin_context_metal_impeller_;
+  FlutterDarwinContextMetalImpeller* darwin_context_metal_impeller_;
   std::shared_ptr<impeller::AiksContext> aiks_context_;
 
   // |IOSContext|
@@ -44,9 +44,8 @@
   std::unique_ptr<GLContextResult> MakeCurrent() override;
 
   // |IOSContext|
-  std::unique_ptr<Texture> CreateExternalTexture(
-      int64_t texture_id,
-      fml::scoped_nsobject<NSObject<FlutterTexture>> texture) override;
+  std::unique_ptr<Texture> CreateExternalTexture(int64_t texture_id,
+                                                 NSObject<FlutterTexture>* texture) override;
 
   // |IOSContext|
   std::shared_ptr<impeller::Context> GetImpellerContext() const override;
diff --git a/shell/platform/darwin/ios/ios_context_metal_impeller.mm b/shell/platform/darwin/ios/ios_context_metal_impeller.mm
index bd0760f..f6f89a3 100644
--- a/shell/platform/darwin/ios/ios_context_metal_impeller.mm
+++ b/shell/platform/darwin/ios/ios_context_metal_impeller.mm
@@ -15,11 +15,11 @@
 
 IOSContextMetalImpeller::IOSContextMetalImpeller(
     const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
-    : darwin_context_metal_impeller_(fml::scoped_nsobject<FlutterDarwinContextMetalImpeller>{
-          [[FlutterDarwinContextMetalImpeller alloc] init:is_gpu_disabled_sync_switch]}) {
-  if (darwin_context_metal_impeller_.get().context) {
+    : darwin_context_metal_impeller_(
+          [[FlutterDarwinContextMetalImpeller alloc] init:is_gpu_disabled_sync_switch]) {
+  if (darwin_context_metal_impeller_.context) {
     aiks_context_ = std::make_shared<impeller::AiksContext>(
-        darwin_context_metal_impeller_.get().context, impeller::TypographerContextSkia::Make());
+        darwin_context_metal_impeller_.context, impeller::TypographerContextSkia::Make());
   }
 }
 
@@ -44,7 +44,7 @@
 
 // |IOSContext|
 std::shared_ptr<impeller::Context> IOSContextMetalImpeller::GetImpellerContext() const {
-  return darwin_context_metal_impeller_.get().context;
+  return darwin_context_metal_impeller_.context;
 }
 
 // |IOSContext|
@@ -61,11 +61,10 @@
 // |IOSContext|
 std::unique_ptr<Texture> IOSContextMetalImpeller::CreateExternalTexture(
     int64_t texture_id,
-    fml::scoped_nsobject<NSObject<FlutterTexture>> texture) {
-  return std::make_unique<IOSExternalTextureMetal>(
-      fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>{[darwin_context_metal_impeller_
-          createExternalTextureWithIdentifier:texture_id
-                                      texture:texture]});
+    NSObject<FlutterTexture>* texture) {
+  return std::make_unique<IOSExternalTextureMetal>([darwin_context_metal_impeller_
+      createExternalTextureWithIdentifier:texture_id
+                                  texture:texture]);
 }
 
 }  // namespace flutter
diff --git a/shell/platform/darwin/ios/ios_context_metal_skia.h b/shell/platform/darwin/ios/ios_context_metal_skia.h
index a9b6ad4..c02302e 100644
--- a/shell/platform/darwin/ios/ios_context_metal_skia.h
+++ b/shell/platform/darwin/ios/ios_context_metal_skia.h
@@ -11,7 +11,6 @@
 
 #include "flutter/fml/macros.h"
 #include "flutter/fml/platform/darwin/cf_utils.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #import "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h"
 #import "flutter/shell/platform/darwin/ios/ios_context.h"
 #include "third_party/skia/include/gpu/ganesh/GrDirectContext.h"
@@ -24,7 +23,7 @@
 
   ~IOSContextMetalSkia();
 
-  fml::scoped_nsobject<FlutterDarwinContextMetalSkia> GetDarwinContext() const;
+  FlutterDarwinContextMetalSkia* GetDarwinContext() const;
 
   // |IOSContext|
   IOSRenderingBackend GetBackend() const override;
@@ -35,7 +34,7 @@
   sk_sp<GrDirectContext> GetResourceContext() const;
 
  private:
-  fml::scoped_nsobject<FlutterDarwinContextMetalSkia> darwin_context_metal_;
+  FlutterDarwinContextMetalSkia* darwin_context_metal_;
 
   // |IOSContext|
   sk_sp<GrDirectContext> CreateResourceContext() override;
@@ -44,9 +43,8 @@
   std::unique_ptr<GLContextResult> MakeCurrent() override;
 
   // |IOSContext|
-  std::unique_ptr<Texture> CreateExternalTexture(
-      int64_t texture_id,
-      fml::scoped_nsobject<NSObject<FlutterTexture>> texture) override;
+  std::unique_ptr<Texture> CreateExternalTexture(int64_t texture_id,
+                                                 NSObject<FlutterTexture>* texture) override;
 
   FML_DISALLOW_COPY_AND_ASSIGN(IOSContextMetalSkia);
 };
diff --git a/shell/platform/darwin/ios/ios_context_metal_skia.mm b/shell/platform/darwin/ios/ios_context_metal_skia.mm
index ebf1a70..6b83cf0 100644
--- a/shell/platform/darwin/ios/ios_context_metal_skia.mm
+++ b/shell/platform/darwin/ios/ios_context_metal_skia.mm
@@ -17,13 +17,12 @@
 namespace flutter {
 
 IOSContextMetalSkia::IOSContextMetalSkia() {
-  darwin_context_metal_ = fml::scoped_nsobject<FlutterDarwinContextMetalSkia>{
-      [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice]};
+  darwin_context_metal_ = [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice];
 }
 
 IOSContextMetalSkia::~IOSContextMetalSkia() = default;
 
-fml::scoped_nsobject<FlutterDarwinContextMetalSkia> IOSContextMetalSkia::GetDarwinContext() const {
+FlutterDarwinContextMetalSkia* IOSContextMetalSkia::GetDarwinContext() const {
   return darwin_context_metal_;
 }
 
@@ -32,16 +31,16 @@
 }
 
 sk_sp<GrDirectContext> IOSContextMetalSkia::GetMainContext() const {
-  return darwin_context_metal_.get().mainContext;
+  return darwin_context_metal_.mainContext;
 }
 
 sk_sp<GrDirectContext> IOSContextMetalSkia::GetResourceContext() const {
-  return darwin_context_metal_.get().resourceContext;
+  return darwin_context_metal_.resourceContext;
 }
 
 // |IOSContext|
 sk_sp<GrDirectContext> IOSContextMetalSkia::CreateResourceContext() {
-  return darwin_context_metal_.get().resourceContext;
+  return darwin_context_metal_.resourceContext;
 }
 
 // |IOSContext|
@@ -53,10 +52,9 @@
 // |IOSContext|
 std::unique_ptr<Texture> IOSContextMetalSkia::CreateExternalTexture(
     int64_t texture_id,
-    fml::scoped_nsobject<NSObject<FlutterTexture>> texture) {
+    NSObject<FlutterTexture>* texture) {
   return std::make_unique<IOSExternalTextureMetal>(
-      fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>{
-          [darwin_context_metal_ createExternalTextureWithIdentifier:texture_id texture:texture]});
+      [darwin_context_metal_ createExternalTextureWithIdentifier:texture_id texture:texture]);
 }
 
 }  // namespace flutter
diff --git a/shell/platform/darwin/ios/ios_context_noop.h b/shell/platform/darwin/ios/ios_context_noop.h
index b4c8ec9..b331b90 100644
--- a/shell/platform/darwin/ios/ios_context_noop.h
+++ b/shell/platform/darwin/ios/ios_context_noop.h
@@ -27,9 +27,8 @@
   std::unique_ptr<GLContextResult> MakeCurrent() override;
 
   // |IOSContext|
-  std::unique_ptr<Texture> CreateExternalTexture(
-      int64_t texture_id,
-      fml::scoped_nsobject<NSObject<FlutterTexture>> texture) override;
+  std::unique_ptr<Texture> CreateExternalTexture(int64_t texture_id,
+                                                 NSObject<FlutterTexture>* texture) override;
 
   IOSRenderingBackend GetBackend() const override;
 
diff --git a/shell/platform/darwin/ios/ios_context_noop.mm b/shell/platform/darwin/ios/ios_context_noop.mm
index 1a083eb..254b0d4 100644
--- a/shell/platform/darwin/ios/ios_context_noop.mm
+++ b/shell/platform/darwin/ios/ios_context_noop.mm
@@ -3,8 +3,8 @@
 // found in the LICENSE file.
 
 #import "flutter/shell/platform/darwin/ios/ios_context_noop.h"
+#include "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
 #include "ios_context.h"
-#include "shell/platform/darwin/ios/rendering_api_selection.h"
 
 FLUTTER_ASSERT_ARC
 
@@ -37,9 +37,8 @@
 }
 
 // |IOSContext|
-std::unique_ptr<Texture> IOSContextNoop::CreateExternalTexture(
-    int64_t texture_id,
-    fml::scoped_nsobject<NSObject<FlutterTexture>> texture) {
+std::unique_ptr<Texture> IOSContextNoop::CreateExternalTexture(int64_t texture_id,
+                                                               NSObject<FlutterTexture>* texture) {
   // Don't use FML for logging as it will contain engine specific details. This is a user facing
   // message.
   NSLog(@"Flutter: Attempted to composite external texture sources using the noop backend. "
diff --git a/shell/platform/darwin/ios/ios_context_software.h b/shell/platform/darwin/ios/ios_context_software.h
index 3731bd3..5ed7393 100644
--- a/shell/platform/darwin/ios/ios_context_software.h
+++ b/shell/platform/darwin/ios/ios_context_software.h
@@ -27,9 +27,8 @@
   std::unique_ptr<GLContextResult> MakeCurrent() override;
 
   // |IOSContext|
-  std::unique_ptr<Texture> CreateExternalTexture(
-      int64_t texture_id,
-      fml::scoped_nsobject<NSObject<FlutterTexture>> texture) override;
+  std::unique_ptr<Texture> CreateExternalTexture(int64_t texture_id,
+                                                 NSObject<FlutterTexture>* texture) override;
 
  private:
   FML_DISALLOW_COPY_AND_ASSIGN(IOSContextSoftware);
diff --git a/shell/platform/darwin/ios/ios_context_software.mm b/shell/platform/darwin/ios/ios_context_software.mm
index 15a7e2e..545c56a 100644
--- a/shell/platform/darwin/ios/ios_context_software.mm
+++ b/shell/platform/darwin/ios/ios_context_software.mm
@@ -33,7 +33,7 @@
 // |IOSContext|
 std::unique_ptr<Texture> IOSContextSoftware::CreateExternalTexture(
     int64_t texture_id,
-    fml::scoped_nsobject<NSObject<FlutterTexture>> texture) {
+    NSObject<FlutterTexture>* texture) {
   // Don't use FML for logging as it will contain engine specific details. This is a user facing
   // message.
   NSLog(@"Flutter: Attempted to composite external texture sources using the software backend. "
diff --git a/shell/platform/darwin/ios/ios_external_texture_metal.h b/shell/platform/darwin/ios/ios_external_texture_metal.h
index 5a6dfd2..c635bb1 100644
--- a/shell/platform/darwin/ios/ios_external_texture_metal.h
+++ b/shell/platform/darwin/ios/ios_external_texture_metal.h
@@ -7,7 +7,6 @@
 
 #include "flutter/common/graphics/texture.h"
 #include "flutter/fml/macros.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #import "flutter/shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.h"
 
 namespace flutter {
@@ -15,15 +14,13 @@
 class IOSExternalTextureMetal final : public Texture {
  public:
   explicit IOSExternalTextureMetal(
-      const fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>&
-          darwin_external_texture_metal);
+      FlutterDarwinExternalTextureMetal* darwin_external_texture_metal);
 
   // |Texture|
   ~IOSExternalTextureMetal();
 
  private:
-  fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>
-      darwin_external_texture_metal_;
+  FlutterDarwinExternalTextureMetal* darwin_external_texture_metal_;
 
   // |Texture|
   void Paint(PaintContext& context,
diff --git a/shell/platform/darwin/ios/ios_external_texture_metal.mm b/shell/platform/darwin/ios/ios_external_texture_metal.mm
index 4e77bd3..8985639 100644
--- a/shell/platform/darwin/ios/ios_external_texture_metal.mm
+++ b/shell/platform/darwin/ios/ios_external_texture_metal.mm
@@ -10,7 +10,7 @@
 namespace flutter {
 
 IOSExternalTextureMetal::IOSExternalTextureMetal(
-    const fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>& darwin_external_texture_metal)
+    FlutterDarwinExternalTextureMetal* darwin_external_texture_metal)
     : Texture([darwin_external_texture_metal textureID]),
       darwin_external_texture_metal_(darwin_external_texture_metal) {}
 
diff --git a/shell/platform/darwin/ios/ios_surface.h b/shell/platform/darwin/ios/ios_surface.h
index 96970a4..1c74ac1 100644
--- a/shell/platform/darwin/ios/ios_surface.h
+++ b/shell/platform/darwin/ios/ios_surface.h
@@ -12,7 +12,6 @@
 #include "flutter/flow/embedded_views.h"
 #include "flutter/flow/surface.h"
 #include "flutter/fml/macros.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 
 @class CALayer;
 
@@ -20,8 +19,7 @@
 
 class IOSSurface {
  public:
-  static std::unique_ptr<IOSSurface> Create(std::shared_ptr<IOSContext> context,
-                                            const fml::scoped_nsobject<CALayer>& layer);
+  static std::unique_ptr<IOSSurface> Create(std::shared_ptr<IOSContext> context, CALayer* layer);
 
   std::shared_ptr<IOSContext> GetContext() const;
 
diff --git a/shell/platform/darwin/ios/ios_surface.mm b/shell/platform/darwin/ios/ios_surface.mm
index ae27f5f..437e065 100644
--- a/shell/platform/darwin/ios/ios_surface.mm
+++ b/shell/platform/darwin/ios/ios_surface.mm
@@ -17,18 +17,18 @@
 namespace flutter {
 
 std::unique_ptr<IOSSurface> IOSSurface::Create(std::shared_ptr<IOSContext> context,
-                                               const fml::scoped_nsobject<CALayer>& layer) {
+                                               CALayer* layer) {
   FML_DCHECK(layer);
   FML_DCHECK(context);
 
   if (@available(iOS METAL_IOS_VERSION_BASELINE, *)) {
-    if ([layer.get() isKindOfClass:[CAMetalLayer class]]) {
+    if ([layer isKindOfClass:[CAMetalLayer class]]) {
       switch (context->GetBackend()) {
         case IOSRenderingBackend::kSkia:
 #if !SLIMPELLER
           return std::make_unique<IOSSurfaceMetalSkia>(
-              fml::scoped_nsobject<CAMetalLayer>((CAMetalLayer*)layer.get()),  // Metal layer
-              std::move(context)                                               // context
+              static_cast<CAMetalLayer*>(layer),  // Metal layer
+              std::move(context)                  // context
           );
 #else   //  !SLIMPELLER
           FML_LOG(FATAL) << "Impeller opt-out unavailable.";
@@ -37,8 +37,8 @@
           break;
         case IOSRenderingBackend::kImpeller:
           return std::make_unique<IOSSurfaceMetalImpeller>(
-              fml::scoped_nsobject<CAMetalLayer>((CAMetalLayer*)layer.get()),  // Metal layer
-              std::move(context)                                               // context
+              static_cast<CAMetalLayer*>(layer),  // Metal layer
+              std::move(context)                  // context
           );
       }
     }
diff --git a/shell/platform/darwin/ios/ios_surface_metal_impeller.h b/shell/platform/darwin/ios/ios_surface_metal_impeller.h
index 86c5171..527e0f9 100644
--- a/shell/platform/darwin/ios/ios_surface_metal_impeller.h
+++ b/shell/platform/darwin/ios/ios_surface_metal_impeller.h
@@ -21,14 +21,13 @@
     : public IOSSurface,
       public GPUSurfaceMetalDelegate {
  public:
-  IOSSurfaceMetalImpeller(const fml::scoped_nsobject<CAMetalLayer>& layer,
-                          const std::shared_ptr<IOSContext>& context);
+  IOSSurfaceMetalImpeller(CAMetalLayer* layer, const std::shared_ptr<IOSContext>& context);
 
   // |IOSSurface|
   ~IOSSurfaceMetalImpeller();
 
  private:
-  fml::scoped_nsobject<CAMetalLayer> layer_;
+  CAMetalLayer* layer_;
   const std::shared_ptr<impeller::Context> impeller_context_;
   std::shared_ptr<impeller::AiksContext> aiks_context_;
   bool is_valid_ = false;
diff --git a/shell/platform/darwin/ios/ios_surface_metal_impeller.mm b/shell/platform/darwin/ios/ios_surface_metal_impeller.mm
index c3a67bb..fdca57b 100644
--- a/shell/platform/darwin/ios/ios_surface_metal_impeller.mm
+++ b/shell/platform/darwin/ios/ios_surface_metal_impeller.mm
@@ -15,7 +15,7 @@
 
 namespace flutter {
 
-IOSSurfaceMetalImpeller::IOSSurfaceMetalImpeller(const fml::scoped_nsobject<CAMetalLayer>& layer,
+IOSSurfaceMetalImpeller::IOSSurfaceMetalImpeller(CAMetalLayer* layer,
                                                  const std::shared_ptr<IOSContext>& context)
     : IOSSurface(context),
       GPUSurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer),
@@ -44,7 +44,7 @@
 // |IOSSurface|
 std::unique_ptr<Surface> IOSSurfaceMetalImpeller::CreateGPUSurface(GrDirectContext*) {
   impeller_context_->UpdateOffscreenLayerPixelFormat(
-      impeller::FromMTLPixelFormat(layer_.get().pixelFormat));
+      impeller::FromMTLPixelFormat(layer_.pixelFormat));
   return std::make_unique<GPUSurfaceMetalImpeller>(this,          //
                                                    aiks_context_  //
   );
@@ -52,17 +52,16 @@
 
 // |GPUSurfaceMetalDelegate|
 GPUCAMetalLayerHandle IOSSurfaceMetalImpeller::GetCAMetalLayer(const SkISize& frame_info) const {
-  CAMetalLayer* layer = layer_.get();
   const auto drawable_size = CGSizeMake(frame_info.width(), frame_info.height());
-  if (!CGSizeEqualToSize(drawable_size, layer.drawableSize)) {
-    layer.drawableSize = drawable_size;
+  if (!CGSizeEqualToSize(drawable_size, layer_.drawableSize)) {
+    layer_.drawableSize = drawable_size;
   }
 
   // Flutter needs to read from the color attachment in cases where there are effects such as
   // backdrop filters. Flutter plugins that create platform views may also read from the layer.
-  layer.framebufferOnly = NO;
+  layer_.framebufferOnly = NO;
 
-  return (__bridge GPUCAMetalLayerHandle)layer;
+  return (__bridge GPUCAMetalLayerHandle)layer_;
 }
 
 // |GPUSurfaceMetalDelegate|
diff --git a/shell/platform/darwin/ios/ios_surface_metal_skia.h b/shell/platform/darwin/ios/ios_surface_metal_skia.h
index e696bab..3a3a20b 100644
--- a/shell/platform/darwin/ios/ios_surface_metal_skia.h
+++ b/shell/platform/darwin/ios/ios_surface_metal_skia.h
@@ -19,14 +19,13 @@
 class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetalSkia final : public IOSSurface,
                                                                   public GPUSurfaceMetalDelegate {
  public:
-  IOSSurfaceMetalSkia(const fml::scoped_nsobject<CAMetalLayer>& layer,
-                      std::shared_ptr<IOSContext> context);
+  IOSSurfaceMetalSkia(CAMetalLayer* layer, std::shared_ptr<IOSContext> context);
 
   // |IOSSurface|
   ~IOSSurfaceMetalSkia();
 
  private:
-  fml::scoped_nsobject<CAMetalLayer> layer_;
+  CAMetalLayer* layer_;
   id<MTLDevice> device_;
   id<MTLCommandQueue> command_queue_;
   bool is_valid_ = false;
diff --git a/shell/platform/darwin/ios/ios_surface_metal_skia.mm b/shell/platform/darwin/ios/ios_surface_metal_skia.mm
index 6c0b534..61266ab 100644
--- a/shell/platform/darwin/ios/ios_surface_metal_skia.mm
+++ b/shell/platform/darwin/ios/ios_surface_metal_skia.mm
@@ -18,19 +18,13 @@
 
 namespace flutter {
 
-static IOSContextMetalSkia* CastToMetalContext(const std::shared_ptr<IOSContext>& context)
-    __attribute__((cf_audited_transfer)) {
-  return (IOSContextMetalSkia*)context.get();
-}
-
-IOSSurfaceMetalSkia::IOSSurfaceMetalSkia(const fml::scoped_nsobject<CAMetalLayer>& layer,
-                                         std::shared_ptr<IOSContext> context)
+IOSSurfaceMetalSkia::IOSSurfaceMetalSkia(CAMetalLayer* layer, std::shared_ptr<IOSContext> context)
     : IOSSurface(std::move(context)),
       GPUSurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer),
       layer_(layer) {
   is_valid_ = layer_;
-  auto metal_context = CastToMetalContext(GetContext());
-  auto darwin_context = metal_context->GetDarwinContext().get();
+  IOSContextMetalSkia* metal_context = static_cast<IOSContextMetalSkia*>(GetContext().get());
+  FlutterDarwinContextMetalSkia* darwin_context = metal_context->GetDarwinContext();
   command_queue_ = darwin_context.commandQueue;
   device_ = darwin_context.device;
 }
@@ -58,25 +52,24 @@
 
 // |GPUSurfaceMetalDelegate|
 GPUCAMetalLayerHandle IOSSurfaceMetalSkia::GetCAMetalLayer(const SkISize& frame_info) const {
-  CAMetalLayer* layer = layer_.get();
-  layer.device = device_;
+  layer_.device = device_;
 
-  layer.pixelFormat = MTLPixelFormatBGRA8Unorm;
+  layer_.pixelFormat = MTLPixelFormatBGRA8Unorm;
   // Flutter needs to read from the color attachment in cases where there are effects such as
   // backdrop filters. Flutter plugins that create platform views may also read from the layer.
-  layer.framebufferOnly = NO;
+  layer_.framebufferOnly = NO;
 
   const auto drawable_size = CGSizeMake(frame_info.width(), frame_info.height());
-  if (!CGSizeEqualToSize(drawable_size, layer.drawableSize)) {
-    layer.drawableSize = drawable_size;
+  if (!CGSizeEqualToSize(drawable_size, layer_.drawableSize)) {
+    layer_.drawableSize = drawable_size;
   }
 
   // When there are platform views in the scene, the drawable needs to be presented in the same
   // transaction as the one created for platform views. When the drawable are being presented from
   // the raster thread, there is no such transaction.
-  layer.presentsWithTransaction = [[NSThread currentThread] isMainThread];
+  layer_.presentsWithTransaction = [[NSThread currentThread] isMainThread];
 
-  return (__bridge GPUCAMetalLayerHandle)layer;
+  return (__bridge GPUCAMetalLayerHandle)layer_;
 }
 
 // |GPUSurfaceMetalDelegate|
diff --git a/shell/platform/darwin/ios/ios_surface_noop.h b/shell/platform/darwin/ios/ios_surface_noop.h
index d3902a9..94b2232 100644
--- a/shell/platform/darwin/ios/ios_surface_noop.h
+++ b/shell/platform/darwin/ios/ios_surface_noop.h
@@ -5,7 +5,6 @@
 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_NOOP_H_
 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_NOOP_H_
 
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #import "flutter/shell/platform/darwin/ios/ios_context.h"
 #import "flutter/shell/platform/darwin/ios/ios_surface.h"
 
diff --git a/shell/platform/darwin/ios/ios_surface_software.h b/shell/platform/darwin/ios/ios_surface_software.h
index e1ed6b6..8f0088c 100644
--- a/shell/platform/darwin/ios/ios_surface_software.h
+++ b/shell/platform/darwin/ios/ios_surface_software.h
@@ -7,7 +7,6 @@
 
 #include "flutter/flow/embedded_views.h"
 #include "flutter/fml/macros.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "flutter/shell/gpu/gpu_surface_software.h"
 #import "flutter/shell/platform/darwin/ios/ios_context.h"
 #import "flutter/shell/platform/darwin/ios/ios_surface.h"
@@ -20,8 +19,7 @@
 
 class IOSSurfaceSoftware final : public IOSSurface, public GPUSurfaceSoftwareDelegate {
  public:
-  IOSSurfaceSoftware(const fml::scoped_nsobject<CALayer>& layer,
-                     std::shared_ptr<IOSContext> context);
+  IOSSurfaceSoftware(CALayer* layer, std::shared_ptr<IOSContext> context);
 
   ~IOSSurfaceSoftware() override;
 
@@ -41,7 +39,7 @@
   bool PresentBackingStore(sk_sp<SkSurface> backing_store) override;
 
  private:
-  fml::scoped_nsobject<CALayer> layer_;
+  CALayer* layer_;
   sk_sp<SkSurface> sk_surface_;
 
   FML_DISALLOW_COPY_AND_ASSIGN(IOSSurfaceSoftware);
diff --git a/shell/platform/darwin/ios/ios_surface_software.mm b/shell/platform/darwin/ios/ios_surface_software.mm
index c67facb..aba83b7 100644
--- a/shell/platform/darwin/ios/ios_surface_software.mm
+++ b/shell/platform/darwin/ios/ios_surface_software.mm
@@ -19,8 +19,7 @@
 
 namespace flutter {
 
-IOSSurfaceSoftware::IOSSurfaceSoftware(const fml::scoped_nsobject<CALayer>& layer,
-                                       std::shared_ptr<IOSContext> context)
+IOSSurfaceSoftware::IOSSurfaceSoftware(CALayer* layer, std::shared_ptr<IOSContext> context)
     : IOSSurface(std::move(context)), layer_(layer) {}
 
 IOSSurfaceSoftware::~IOSSurfaceSoftware() = default;
@@ -120,7 +119,7 @@
     return false;
   }
 
-  layer_.get().contents = (__bridge id)(static_cast<CGImageRef>(pixmap_image));
+  layer_.contents = (__bridge id) static_cast<CGImageRef>(pixmap_image);
 
   return true;
 }
diff --git a/shell/platform/darwin/ios/platform_message_handler_ios.h b/shell/platform/darwin/ios/platform_message_handler_ios.h
index b212e22..9c50c08 100644
--- a/shell/platform/darwin/ios/platform_message_handler_ios.h
+++ b/shell/platform/darwin/ios/platform_message_handler_ios.h
@@ -6,7 +6,6 @@
 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_PLATFORM_MESSAGE_HANDLER_IOS_H_
 
 #include "flutter/fml/platform/darwin/scoped_block.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "flutter/fml/task_runner.h"
 #include "flutter/shell/common/platform_message_handler.h"
 #import "flutter/shell/platform/darwin/ios/flutter_task_queue_dispatch.h"
@@ -33,7 +32,7 @@
                          NSObject<FlutterTaskQueue>* task_queue);
 
   struct HandlerInfo {
-    fml::scoped_nsprotocol<NSObject<FlutterTaskQueueDispatch>*> task_queue;
+    NSObject<FlutterTaskQueueDispatch>* task_queue;
     fml::ScopedBlock<FlutterBinaryMessageHandler> handler;
   };
 
diff --git a/shell/platform/darwin/ios/platform_message_handler_ios.mm b/shell/platform/darwin/ios/platform_message_handler_ios.mm
index e1257b5..e16382f 100644
--- a/shell/platform/darwin/ios/platform_message_handler_ios.mm
+++ b/shell/platform/darwin/ios/platform_message_handler_ios.mm
@@ -80,8 +80,8 @@
         });
       };
 
-      if (handler_info.task_queue.get()) {
-        [handler_info.task_queue.get() dispatch:run_handler];
+      if (handler_info.task_queue) {
+        [handler_info.task_queue dispatch:run_handler];
       } else {
         dispatch_async(dispatch_get_main_queue(), run_handler);
       }
@@ -124,8 +124,7 @@
   message_handlers_.erase(channel);
   if (handler) {
     message_handlers_[channel] = {
-        .task_queue =
-            fml::scoped_nsprotocol(static_cast<NSObject<FlutterTaskQueueDispatch>*>(task_queue)),
+        .task_queue = (NSObject<FlutterTaskQueueDispatch>*)task_queue,
         .handler =
             fml::ScopedBlock<FlutterBinaryMessageHandler>{
                 handler, fml::scoped_policy::OwnershipPolicy::kRetain},
diff --git a/shell/platform/darwin/ios/platform_view_ios.mm b/shell/platform/darwin/ios/platform_view_ios.mm
index 4541e10..f651d00 100644
--- a/shell/platform/darwin/ios/platform_view_ios.mm
+++ b/shell/platform/darwin/ios/platform_view_ios.mm
@@ -116,7 +116,7 @@
   FML_DCHECK(owner_controller_.isViewLoaded) << "FlutterViewController's view should be loaded "
                                                 "before attaching to PlatformViewIOS.";
   FlutterView* flutter_view = static_cast<FlutterView*>(owner_controller_.view);
-  auto ca_layer = fml::scoped_nsobject<CALayer>{[flutter_view layer]};
+  CALayer* ca_layer = flutter_view.layer;
   ios_surface_ = IOSSurface::Create(ios_context_, ca_layer);
   FML_DCHECK(ios_surface_ != nullptr);
 
@@ -134,8 +134,7 @@
 
 void PlatformViewIOS::RegisterExternalTexture(int64_t texture_id,
                                               NSObject<FlutterTexture>* texture) {
-  RegisterTexture(ios_context_->CreateExternalTexture(
-      texture_id, fml::scoped_nsobject<NSObject<FlutterTexture>>{texture}));
+  RegisterTexture(ios_context_->CreateExternalTexture(texture_id, texture));
 }
 
 // |PlatformView|
diff --git a/testing/test_metal_context.mm b/testing/test_metal_context.mm
index 156a3f8..370af6f 100644
--- a/testing/test_metal_context.mm
+++ b/testing/test_metal_context.mm
@@ -8,7 +8,6 @@
 #include <iostream>
 
 #include "flutter/fml/logging.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "third_party/skia/include/core/SkSurface.h"
 #include "third_party/skia/include/gpu/ganesh/GrDirectContext.h"
 #include "third_party/skia/include/gpu/ganesh/mtl/GrMtlBackendContext.h"
diff --git a/testing/test_metal_surface_impl.mm b/testing/test_metal_surface_impl.mm
index 550001a..8aac974 100644
--- a/testing/test_metal_surface_impl.mm
+++ b/testing/test_metal_surface_impl.mm
@@ -7,7 +7,6 @@
 #include <Metal/Metal.h>
 
 #include "flutter/fml/logging.h"
-#include "flutter/fml/platform/darwin/scoped_nsobject.h"
 #include "flutter/testing/test_metal_context.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/core/SkColorSpace.h"