[SwiftUI] Text, custom font
Language/Swift2022. 9. 14. 10:20[SwiftUI] Text, custom font

Text : 원하는 문자열을 표현하는 뷰 VStack { Text("폰트 설정 및 폰트 굵기") .font(.title2) .fontWeight(.bold) Text("foreground 글자색, background 배경색") .foregroundColor(.white) .padding() .background(Color.brown) // Color 명시 Text("커스텀 폰트") .font(.custom("Gaegu-Regular", size: 16)) Text("볼드체") .bold() Text("밑줄") .underline() Text("취소선") .strikethrough() Text("라인 수 2줄로 제한을 하려고 합니다 \n 그리고 오른쪽 정렬 \n 이건 안 보일테죠") .lineLimit(2..

[SwiftUI] Group , GroupBox
Language/Swift2022. 9. 13. 11:24[SwiftUI] Group , GroupBox

Group : A type that collects multiple instances of a content type — like views, scenes, or commands — into a single unit. Use a group to collect multiple views into a single instance, without affecting the layout of those views, like an HStack, VStack, or Section would. After creating a group, any modifier you apply to the group affects all of that group’s members. This is particularly important..

[SwiftUI] TabView, TabViewStyle
Language/Swift2022. 9. 12. 17:15[SwiftUI] TabView, TabViewStyle

TapView : A view that switches between multiple child views using interactive user interface elements. To create a user interface with tabs, place views in a TabView and apply the tabItem(_:) modifier to the contents of each tab. On iOS, you can also use one of the badge modifiers, like badge(_:), to assign a badge to each of the tabs. Use a Label for each tab item, or optionally a Text, an Imag..

[SwiftUI] ScrollView
Language/Swift2022. 9. 12. 16:32[SwiftUI] ScrollView

ScrollView : A scrollable view The scroll view displays its content within the scrollable content region. As the user performs platform-appropriate scroll gestures, the scroll view adjusts what portion of the underlying content is visible. ScrollView can scroll horizontally, vertically, or both, but does not provide zooming functionality. var body: some View { ScrollView { VStack(alignment: .lea..

[SwiftUI] NavigationView
Language/Swift2022. 9. 12. 14:02[SwiftUI] NavigationView

NavigationView Deprecated A view for presenting a stack of views that represents a visible path in a navigation hierarchy Deprecated (22. 9. 12.) Use NavigationStack and NavigationSplitView instead. For more information, see Migrating to new navigation types. Use a NavigationView to create a navigation-based app in which the user can traverse a collection of views. Users navigate to a destinatio..

[SwiftUI] @Environment
Language/Swift2022. 9. 12. 12:14[SwiftUI] @Environment

@Environment : A property wrapper that reads a value from a view’s environment Use the Environment property wrapper to read a value stored in a view’s environment. Indicate the value to read using an EnvironmentValues key path in the property declaration. For example, you can create a property that reads the color scheme of the current view using the key path of the colorScheme property: @Enviro..

[SwiftUI] @State @binding
Language/Swift2022. 9. 12. 10:27[SwiftUI] @State @binding

@State : A property wrapper type that can read and write a value managed by SwiftUI SwiftUI manages the storage of a property that you declare as state. When the value changes, SwiftUI updates the parts of the view hierarchy that depend on the value. Use state as the single source of truth for a given value stored in a view hierarchy. A State instance isn’t the value itself; it’s a means of read..

[Swift] xcode template file modified, Add Snippet
Language/Swift2022. 9. 10. 21:59[Swift] xcode template file modified, Add Snippet

저는 swiftUI 파일을 수정하는 방법을 아래와 같이 설명하였습니다. // in terminal cd /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/MultiPlatform/User Interface/SwiftUI View.xctemplate open . 해당 주소로 접근하게 되면 ___FILEBASENAMEASIDENTIFIER___.swift 의 파일이 존재합니다. 해당 파일은 기존에 swift 파일 생성 시 만들어질 때 사용되는 것으로 잠김 파일이지만, 복제 후 교체하여 해당 파일을 원하는 형태로 수정을 하였습니다. //___FILEHEADER___ import SwiftUI struct ___FI..

image