3
2

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 1 year has passed since last update.

はじめに

「Dispaly Name」でアプリ名を指定できます。
今回はここの「Display Name」をコードで取得します。
スクリーンショット 2023-07-19 19.54.54.png

実装

import SwiftUI

struct ContentView: View {
    private let appName = Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String
    var body: some View {
        Text(appName ?? "???")
    }
}

取得できました
simulator_screenshot_ABDFFF2B-AA05-411B-913F-A2D16E3AD28E.png

おわり

「Display Name」が空だとnilが返ってきます

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?