見出し画像

【開発iOS8】フォントサイズの基本

概要

プロパティラッパーと同じくらい
意外と、

「あれ?なんだったっけ?」

ってなりそうだったから、フォントサイズの基本をまとめてみた

一覧(基本のみ)


基本のみ

シミュレーター


色も基本のみ

コード

import SwiftUI

struct FontSize: View {
    var body: some View {
        VStack{
            Spacer()
            Text(".largeTitle")
                .font(.largeTitle)
                .foregroundColor(Color.red)
                .padding(.bottom)
            Text(".title")
                .font(.title)
                .foregroundColor(Color.blue)
                .padding(.bottom)
            Text(".headline")
                .font(.headline)
                .foregroundColor(Color.yellow)
                .padding(.bottom)
            Text(".subheadline")
                .font(.subheadline)
                .foregroundColor(Color.pink)
                .padding(.bottom)
            Text(".body")
                .font(.body)
                .foregroundColor(Color.orange)
                .padding(.bottom)
            Text(".callout")
                .font(.callout)
                .foregroundColor(Color.purple)
                .padding(.bottom)
            Text(".footnote")
                .font(.footnote)
                .foregroundColor(Color.green)
                .padding(.bottom)
            Text(".caption")
                .font(.caption)
                .foregroundColor(Color.brown)
                .padding(.bottom)
            Spacer()
        }.padding()
    }
}

struct FontSize_Previews: PreviewProvider {
    static var previews: some View {
        FontSize()
    }
}

以上。

初歩の初歩って思われるかもしれないけど、

AutoLayoutなんかで相対的なサイズ設定は、SwiftUIでも旨味になるから、

何かの時に見返してみてね〜〜〜〜

参考文献


この記事が気に入ったらサポートをしてみませんか?