분류 전체보기44 Alert & ConfirmationDialog func alert(_ titleKey: LocalizedStringKey, isPresented: Binding, @ViewBuilder actions: () -> A, @ViewBuilder message: () -> M) -> some View where A: View, M: View struct AlertView: View { @State private var isShowing = false var body: some View { Button { isShowing.toggle() } label: { Text("Click Me!") } .alert("Alert Title", isPresented: $isShowing) { Button("확인", role: .none) { // 확인 버튼 눌렀을 때 .. 2023. 11. 20. 새 화면 띄우기 Modal Style func sheet( isPresented: Binding, onDismiss: (() -> Void)?, content: () -> Content) -> some View struct ModalView: View { @State private var isShowing = false var body: some View { Button { isShowing.toggle() } label: { Text("Click Me!") } .sheet(isPresented: $isShowing) { Text("Modal") .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color.blue) .foregroundStyle(.white).. 2023. 11. 20. 다크모드 색상지원 Preview 하단의 아이콘을 눌러 Color Scheme을 활성화하면 Light/Dark 모드를 변경할 수 있다. 하나의 색상 이름으로 Light/Dark 모드를 모두 지원하려면 Assets 에서 Color Set을 추가한다. Color Set 이름을 MainFontColor로 지정 후 Dark 모드 일때는 하늘색, 그 외에는 검정색으로 설정했다. struct ContentView: View { var body: some View { Text("Hello, world!") .font(.largeTitle) .foregroundStyle(Color("MainFontColor", bundle: nil)) .padding() } } foregroundStyle 로 위에서 지정한 폰트 색상을 설정하고 Ligh.. 2023. 11. 19. 블로그를 개설한 이유 기록이 필요했다. 하루도 빠짐없이 무언가를 배우고 느끼고 알게 되었는데 너무 빨리 흩어졌다. 나에게 변화가 있다는 것은 알지만 언제부터 어떻게 변한 건지 알 수가 없다. 좋은 것은 더 받아들이고 나쁜 것은 바로잡고 싶은데 기록이 없으니 모든 것이 어려웠다. 심지어 내가 무엇을 좋아하고 싫어하는지 설명하는데도 어려웠다. 그래서 기록이 필요했다. 나를 이해하는 데 그리고 나를 이해시키는 데 기록이 필요했다. 바라건대 이 기록들이 나의 거울이 될 수 있기를. 2023. 9. 4. 이전 1 ··· 8 9 10 11 다음