@@ -66,27 +66,36 @@ public struct RootView: View {
6666 }
6767 . alert ( $store. scope ( state: \. alert, action: \. alert) )
6868 . sheet ( item: $store. scope ( state: \. sheet, action: \. sheet) ) { sheetStore in
69- NavigationStack {
70- TodoDetailView ( store: Store (
71- initialState: TodoDetailFeature . State ( todoId: sheetStore. todoId, showEditButton: false )
72- ) {
73- TodoDetailFeature ( )
74- } withDependencies: {
75- $0. fetchTodoByIdUseCase = container. resolve ( FetchTodoByIdUseCase . self)
76- $0. fetchReferenceItemsUseCase = container. resolve ( FetchReferenceItemsUseCase . self)
77- } )
78- . toolbar {
79- ToolbarLeadingButton {
80- sheetStore. send ( . tapCloseButton)
81- }
82- }
69+ sheetContent ( todoId: sheetStore. todoId) {
70+ sheetStore. send ( . tapCloseButton)
8371 }
84- . background ( Color ( . systemGroupedBackground) )
85- . presentationDragIndicator ( . visible)
8672 }
8773 . onReceive ( pushNotificationTodoIdPublisher) { todoId in
8874 store. send ( . presentTodoDetail( todoId) )
8975 clearPushNotificationRoute ( )
9076 }
9177 }
78+
79+ private func sheetContent(
80+ todoId: String ,
81+ onClose: @escaping ( ) -> Void
82+ ) -> some View {
83+ NavigationStack {
84+ TodoDetailView ( store: Store (
85+ initialState: TodoDetailFeature . State ( todoId: todoId, showEditButton: false )
86+ ) {
87+ TodoDetailFeature ( )
88+ } withDependencies: {
89+ $0. fetchTodoByIdUseCase = container. resolve ( FetchTodoByIdUseCase . self)
90+ $0. fetchReferenceItemsUseCase = container. resolve ( FetchReferenceItemsUseCase . self)
91+ } )
92+ . toolbar {
93+ ToolbarLeadingButton {
94+ onClose ( )
95+ }
96+ }
97+ }
98+ . background ( Color ( . systemGroupedBackground) )
99+ . presentationDragIndicator ( . visible)
100+ }
92101}
0 commit comments