Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions GAMSS/Sources/Core/Components/Modal/ModalContainerView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// ModalContainerView.swift
// GAMSS
//
// Created by 이건준 on 8/4/26.
//

import SwiftUI

struct ModalContainerView<Content: View>: View {
@Binding private var isPresented: Bool

private let dismissOnBackgroundTap: Bool
private let content: () -> Content

init(
isPresented: Binding<Bool>,
dismissOnBackgroundTap: Bool = true,
@ViewBuilder content: @escaping () -> Content
) {
self._isPresented = isPresented
self.dismissOnBackgroundTap = dismissOnBackgroundTap
self.content = content
}

var body: some View {
ZStack {
Color.colorBlack
.opacity(0.3)
.ignoresSafeArea()
.onTapGesture {
guard dismissOnBackgroundTap else { return }

withAnimation(.easeInOut(duration: 0.25)) {
isPresented = false
}
}

content()
.transition(.scale.combined(with: .opacity))
}
.animation(.easeInOut(duration: 0.25), value: isPresented)
}
}
Loading