2022/09/23 (1) 썸네일형 리스트형 08 ~09. Alert & Confirmation Dialog Alert SwiftUI로 Alert를 표시하는 데에는 준비물이 하나 필요하다. struct View_Alert: View { @State private var result = "" @State private var alertStat = false var body: some View { VStack { Text(result) .font(.largeTitle) Button(action: { }, label: { Text("Show Alert") }) .padding() } } } 바로 State Variable로 위의 코드에서는 alertStat이라는 이름을 가진다. alert은 해당 변수를 조작하여 자신의 상태를 변경하는데 사용하기 때문에 반드시 필요하다. struct View_Alert: View { .. 이전 1 다음