34
24

More than 3 years have passed since last update.

SwiftUIのTextのfontとfontWeight一覧

Last updated at Posted at 2020-02-10

概要

文字の大きさや太さを一覧で視覚的に残しておきたかったので書きました。
当たり前っちゃ当たり前の内容ですが、パッと見比べる時に有用であればいいなと思います。
iOS14から一部のフォントが追加となっています。

font

文字の大きさを指定します。
ドキュメントなど参照しましたが、デフォルト値を見つけることができなかったのですが、
見た感じは.bodyかと思います。

Text("largeTitle").font(.largeTitle)   // 大きなタイトル
Text("title").font(.title)             // タイトル
Text("headline").font(.headline)       // 見出し
Text("subheadline").font(.subheadline) // 小見出し
Text("body").font(.body)               // 本文
Text("callout").font(.callout)         // 吹き出し
Text("caption").font(.caption)         // キャプション
Text("footnote").font(.footnote)       // 注釈

スクリーンショット 2021-01-16 13.03.27.png

fontWeight

文字の太さを指定します。
こちらもデフォルトは見つからなかったですが、見た感じは``。

Text("black").fontWeight(.black)
Text("bold").fontWeight(.bold)
Text("heavy").fontWeight(.heavy)
Text("light").fontWeight(.light)
Text("medium").fontWeight(.medium)
Text("regular").fontWeight(.regular)
Text("semibold").fontWeight(.semibold)
Text("thin").fontWeight(.thin)
Text("ultraLight").fontWeight(.ultraLight)

スクリーンショット 2020-02-11 8.01.03.png

組み合わせ

組み合わせるとこのような感じに。

Text("largeTitle & black").font(.largeTitle).fontWeight(.black)
Text("footnote & ultraLight").font(.footnote).fontWeight(.ultraLight)

スクリーンショット 2020-02-11 8.06.34.png

34
24
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
34
24