4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[SwiftUI] Textの使い方

Last updated at Posted at 2019-11-29

SwiftUI Textの基本的な使い方メモ

// Hello Worldを表示する
Text("Hello World")

// 行数の制限もできる
Text("Hello World")
    .lineLimit(5)

// 行数を無制限にしたい場合はnil
Text("Hello World")
    .lineLimit(nil)

// 長い文章の場合はtruncationModeを利用して一部省略できる
Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
    .truncationMode(.middle)

// fontの設定
Text("Hello World")
    .font(.largeTitle)

// 背景などの色の設定
Text("Hello World")
    .foregroundColor(Color.white)
    .background(Color.gray)

// 文字の間隔を設定
Text("Hello World")
    .kerning(10)

// 複数行のalignmentを設定
Text("Hello World")
    .multilineTextAlignment(.center)
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?