Skip to content

Latest commit

 

History

History
56 lines (50 loc) · 1.43 KB

File metadata and controls

56 lines (50 loc) · 1.43 KB

Layout - SwiftUI: Text

UIText Init

아래는 기본적인 형태이다.

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            Text("GeekCode")
                .bold()
                .underline()
                .italic()
                .strikethrough()
            Text("GeekCode")
                .font(.body)
            Text("GeekCode")                
                .font(.headline)
            Text("GeekCode")
                .font(.system(.title))
            Text("GeekCode")
                .font(.system(size: 50))
            Text("GeekCode")
                .underline(true, color:.orange)
            Text("GeekCode")
                .foregroundColor(.red)
            Text("GeekCode")
                .background(.purple)
            Text("GeekCode")
                .foregroundColor(.green)
                .font(.system(size: 39,
                              weight: .bold,
                              design: .rounded))
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

아래처럼 여러 옵션을 선택할 수 있다.

  • bold
  • underline
  • italic
  • strikethrough 색상관련 옵션
  • foregroundColor
  • background

스크린샷 2023-02-15 오후 7 18 26