Skip to content

Commit

Permalink
Fix retain cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
anandrajeswaran committed Jan 15, 2025
1 parent a73a822 commit c65af39
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c65af39

Please sign in to comment.