1
1

More than 1 year has passed since last update.

【SwiftUI】iOS16から使えるfontWidthってなに?

Posted at

はじめに

fontWeightは結構使いますが、fontWidthは全然使いません。
使わないのでどんな機能なのかわからなかったのでちょびっと調べてみました。

実装

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack(spacing: 10) {
            Text("fontWidth")
                .fontWidth(.compressed)
            
            Text("fontWidth")
                .fontWidth(.condensed)
            
            Text("fontWidth")
                .fontWidth(.expanded)
            
            Text("fontWidth")
                .fontWidth(.standard)
        }
    }
}

こうなる

Simulator Screenshot - iPhone 14 Pro - 2023-08-05 at 21.56.25.png

全角だとどうなるか

変わらない
simulator_screenshot_55A0C334-B158-44DA-88BA-9B2ADE2EE2AD.png

おわり

全角だと変わらないのには注意が必要そうですね

1
1
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
1
1