SwiftUI로 Nanki (단어장 앱)을 만들어보면서 알게된 점을 총 정리해서 작성했다.생각보다 간단하게 처리하고 사용할 수 있는게 많아서.. SwiftUI에 적응하기 위해서는 UI를 다양하게 많이! 작성해봐야 할듯. [GitHub - JustHm/NankiContribute to JustHm/Nanki development by creating an account on GitHub.github.com](https://github.com/JustHm/Nanki)UI 관련ListList StyleList{ ...}.listStyle(.sidebar)리스트의 기본 스타일은 insetGrouped 로 지정되어있다.그 외에도 여러개가 있는데, sidebar 를 적어놓은 이유는 섹션헤더를 접었다 폈다 하고..
Image | Apple Developer DocumentationA view that displays an image.developer.apple.comImageSwiftUI 의 Image는 Asset 또는 디스크의 이미지를 보여주거나, SFSymbols를 표시할 수 있는 View. UIImage, CGImage도 가능.IOS 13.0 부터 사용가능 기본적으로 사용하는 이미지 표시 방법은 다음과 같다.Image("tempImage")Image(decorative: "tempImage")Image(systemName: "chart.bar.fill")asset에 있는 Image를 가지고 올 수 있으며 Bundle 파라미터도 존재한다. 기본값은 nil공식 문서에서 Image 각 이미지 생성에 Label을 파..
Text("Hello World")사용방법은 간단하다. 위 코드처럼 Text에 string 값을 넣거나 변수로 된 String 값을 넣으면 된다.기본적으로 사용하는 방법은 Text 안에 String 값을 넣는것이지만 그 외에도 많은 생성 방법이 있다.첫 번째 파라미터 이름을 기준으로 순서대로 역할을 알아보았다.AttributedContent - AttributedString Type의 변수를 넣어서 사용할 수 있다. AttributedString은 텍스트의 특정 부분에 스타일을 적용 할 수 있다. (MarkDown, Custom Text)date - Date값을 넣고 Style을 지정하면 스타일에 따라 정해진 표시형식의 텍스트가 출력된다. 옵션으로는 date, time, timer, relative, o..
SwiftUI 에서 Alert 창을 띄우기 위해서는 View의 Modifier인 .alert 메서드를 사용하면 된다. alert(_:isPresented:presenting:actions:message:) | Apple Developer DocumentationPresents an alert with a message using the given data to produce the alert’s content and a string variable as a title.developer.apple.com그런데 SwiftUI는 IOS 14.0을 지원하고, 새로 지원하는 alert modifier는 IOS 15.0 부터 가능하다. (13.0도 SwiftUI를 지원했던 것으로 기억하는데, SwiftUI프로젝트를..