Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hyeonghwan opened this issue Oct 29, 2023 · 0 comments
Open

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

hyeonghwan opened this issue Oct 29, 2023 · 0 comments

Comments

@hyeonghwan
Copy link
Collaborator

홈뷰 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를 한눈에 파악할수 있도록 리팩토링을 진행합니다.

@hyeonghwan hyeonghwan added this to the Sheet,Alert 리팩토링 milestone Oct 29, 2023
@hyeonghwan hyeonghwan self-assigned this Oct 29, 2023
@hyeonghwan hyeonghwan changed the title [Refactoring] 홈뷰 Alert, Sheet 중복 리팩토링 [Refactor] 홈뷰 Alert, Sheet 중복 리팩토링 Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant