0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

カスタムフォントを適用【SwiftUI】

Last updated at Posted at 2025-06-13

間違いや、改善などあればコメントいただけると幸いです。

環境

macOS - Sequoia 15.4.1
Xcode - vVersion 16.0

実装して発生したエラー

Multiple commands produce・・・/PracticeProject.app/Info.plist'

このエラーは、Info.plistがプロジェクト内で複数の場所から参照され、ビルド時に競合しているために発生

解決方法

プロジェクトファイル→BuildPhases→Copy Bundle ResourcesのInfo.plistを削除

参考

やり方

①フォントファイルを用意

1-1 ここから、適用させる字体を選ぶ
  今回はこれ↓
   

1-2 ダウンロードボタンを押下
1-3 Finderでダウンロードしたzipファイルを解凍
1-4 (今回は).ttfファイル(もしくわ.otf)を見つける

②ドラッグ&ドロップ

2-1 Xcodeの任意のファイルにダウンロードした.ttfファイルをドラッグ&ドロップ❶
2-2 Copy files・・・を選択、Targetsを選択→Finishを押下❷




③Info.plistの設定

3-1 プロジェクトファイル→TARGETS→Info→Custom ios Targets Properties
3-2 右クリックでAdd Rowを押下
3-3 Fonts provided by applicationを追加

3-4 Item0にドラッグ&ドロップしたファイル名を入力(.ttfまで入力!!!)
スクリーンショット 2025-06-13 9.51.59.png

④実装

4-1 フォントの名前を入力

Text("Hello, World!")
    .font(.custom("Praegefest", size: 20))

完了!

スクリーンショット 2025-06-13 9.58.48.png

カスタムフォントサイト

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?