File tree Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -284,18 +284,18 @@ final class DemoQuickEditorViewController: UIViewController {
284284
285285 lazy var schemeToggle : UISegmentedControl = {
286286 let control = UISegmentedControl ( items: [
287- UIAction . init ( title: " System " ) { _ in self . customColorScheme = . unspecified } ,
288- UIAction . init ( title: " Light " ) { _ in self . customColorScheme = . light } ,
289- UIAction . init ( title: " Dark " ) { _ in self . customColorScheme = . dark } ,
287+ UIAction . init ( title: " System " ) { [ weak self ] _ in self ? . customColorScheme = . unspecified } ,
288+ UIAction . init ( title: " Light " ) { [ weak self ] _ in self ? . customColorScheme = . light } ,
289+ UIAction . init ( title: " Dark " ) { [ weak self ] _ in self ? . customColorScheme = . dark } ,
290290 ] )
291291 control. selectedSegmentIndex = 0
292292 return control
293293 } ( )
294294
295295 lazy var imageEditorToggle : UISegmentedControl = {
296296 let control = UISegmentedControl ( items: [
297- UIAction . init ( title: " Default Image Editor " ) { _ in self . useCustomImageEditor = false } ,
298- UIAction . init ( title: " Custom Image Editor " ) { _ in self . useCustomImageEditor = true } ,
297+ UIAction . init ( title: " Default Image Editor " ) { [ weak self ] _ in self ? . useCustomImageEditor = false } ,
298+ UIAction . init ( title: " Custom Image Editor " ) { [ weak self ] _ in self ? . useCustomImageEditor = true } ,
299299 ] )
300300 control. selectedSegmentIndex = 0
301301 return control
Original file line number Diff line number Diff line change 11import UIKit
22
3- public class QuickEditorConfiguration {
3+ public struct QuickEditorConfiguration {
44 let interfaceStyle : UIUserInterfaceStyle
55 let customImageEditorProvider : CustomImageEditorControllerProvider ?
66
Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ final class QuickEditorViewController<ImageEditor: ImageEditorView>: UIViewContr
1919
2020 private lazy var isPresented : Binding < Bool > = Binding {
2121 true
22- } set: { isPresented in
22+ } set: { [ weak self ] isPresented in
2323 Task { @MainActor in
2424 guard !isPresented else { return }
25- self . dismiss ( animated: true )
26- self . onDismiss ? ( )
25+ self ? . dismiss ( animated: true )
26+ self ? . onDismiss ? ( )
2727 }
2828 }
2929
@@ -87,7 +87,6 @@ final class QuickEditorViewController<ImageEditor: ImageEditorView>: UIViewContr
8787
8888 override func viewDidLoad( ) {
8989 super. viewDidLoad ( )
90-
9190 quickEditor. willMove ( toParent: self )
9291 addChild ( quickEditor)
9392 view. addSubview ( quickEditor. view)
@@ -111,7 +110,8 @@ final class QuickEditorViewController<ImageEditor: ImageEditorView>: UIViewContr
111110
112111 func updateDetents( ) {
113112 if let sheet = sheetPresentationController {
114- sheet. animateChanges {
113+ sheet. animateChanges { [ weak self] in
114+ guard let self else { return }
115115 sheet. detents = QEDetent . detents (
116116 for: scopeOption,
117117 intrinsicHeight: sheetHeight,
Original file line number Diff line number Diff line change @@ -125,7 +125,9 @@ class AvatarPickerViewModel: ObservableObject {
125125 // Determine if the warning should be displayed
126126 selectedAvatarURL == nil && loadedAvatarCount > 0
127127 }
128- . assign ( to: \. shouldDisplayNoSelectedAvatarWarning, on: self )
128+ . sink { [ weak self] shouldShowWarning in
129+ self ? . shouldDisplayNoSelectedAvatarWarning = shouldShowWarning
130+ }
129131 . store ( in: & cancellables)
130132
131133 $profileResult. sink { [ weak self] profileResult in
You can’t perform that action at this time.
0 commit comments