Skip to content

[Refactor] 홈뷰 Alert, Sheet 중복 리팩토링 #162

@hyeonghwan

Description

@hyeonghwan

홈뷰 Alert, Sheet 리팩토링

AS-IS

    //HOME View
    @State private var isShowingEditTodo: Bool = false
    @State private var isPizzaSeleted: Bool = false
    @State private var isPizzaPuchasePresented: Bool = false
    @State private var showCompleteAlert: Bool = false

현재 홈뷰를 포함한 sheet, alert 를 쓰는 모든 뷰들에서 Bool값을 이용해 트리거 하고 있습니다.
Body의 길이가 길어지고 flow를 코드 상으로 파악하기 힘들고 , 뷰 Feature가 지속적으로 추가되면
추후 개발 과정에서 파악하는데 많은 시간이 소요되고 유지보수 하기 힘들어집니다.

TO-BE

public func sheet<Item, Content>(item: Binding<Item?>,
                                 onDismiss: (() -> Void)? = nil,
                                 @ViewBuilder content: @escaping (Item) -> Content) -> some View  where Item : Identifiable, Content : View

Data Source 에 알맞은 sheet를 통해서 분기처리로 Alert과 , Sheet 를 trigger하는 flow를 한눈에 파악할수 있도록 리팩토링을 진행합니다.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions