From c65af39394d7b02eb4d19faf1e3f2434e63cbc5b Mon Sep 17 00:00:00 2001 From: Anand Rajeswaran Date: Tue, 14 Jan 2025 22:38:01 -0500 Subject: [PATCH] Fix retain cycles --- .../FluentUI.Demo/Demos/BottomSheetDemoController.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Demos/FluentUIDemo_iOS/FluentUI.Demo/Demos/BottomSheetDemoController.swift b/Demos/FluentUIDemo_iOS/FluentUI.Demo/Demos/BottomSheetDemoController.swift index 37d536ac4a..a2af9bdb65 100644 --- a/Demos/FluentUIDemo_iOS/FluentUI.Demo/Demos/BottomSheetDemoController.swift +++ b/Demos/FluentUIDemo_iOS/FluentUI.Demo/Demos/BottomSheetDemoController.swift @@ -118,16 +118,16 @@ class BottomSheetDemoController: DemoController { secondarySheetController.isFlexibleHeight = true secondarySheetController.allowsSwipeToHide = true - let dismissButton = Button(primaryAction: UIAction(title: "Dismiss", handler: { _ in - secondarySheetController.setIsHidden(true, animated: true) + let dismissButton = Button(primaryAction: UIAction(title: "Dismiss", handler: { [weak secondarySheetController] _ in + secondarySheetController?.setIsHidden(true, animated: true) })) dismissButton.style = .accent dismissButton.translatesAutoresizingMaskIntoConstraints = false sheetContentView.addSubview(dismissButton) - let anotherOneButton = Button(primaryAction: UIAction(title: "Show another sheet", handler: { _ in - self.showTransientSheet() + let anotherOneButton = Button(primaryAction: UIAction(title: "Show another sheet", handler: { [weak self] _ in + self?.showTransientSheet() })) anotherOneButton.translatesAutoresizingMaskIntoConstraints = false sheetContentView.addSubview(anotherOneButton)