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?

More than 1 year has passed since last update.

【XCode 15.0】プロジェクトからStoryBoardを抹消する方法が変わった

Last updated at Posted at 2023-10-22

1. 記事の概要

XCodeを15.0にアップデート後、Main.StoryBoardを使わずにコードを実装しようとしたところ、若干ハマったので手順をまとめた

2. 実行環境

  • 実行日: 2023年10月22日
カテゴリ バージョン情報
XCode Version 15.0 beta 2 (15A5161b)
Swift Swift 5

3. 手順のまとめ(結論)

  1. Info.Plistの編集
  2. Main.StoryBoardを抹消
  3. AppDelegate.swiftを編集

4. 手順

4-1. Info.Plistの編集

Info.Plist内のBuild Settings -> Info.plist Values の中にあるUIKit Main StoryBoard File Base NameにデフォルトでMainが設定されているので削除

スクリーンショット 2023-10-22 15.29.57.png

4-2. Main.StoryBoardを抹消

  • プロジェクトナビゲータ内のMain.StoryBoardファイルを右クリック->[Delete]を選択して抹消する

4-3. AppDelegate.swiftを編集

  • AppDelegate.swift内のdidFinishLaunchingWithOptionsメソッドを以下のように書き換えます
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    let rootVC = ViewController() // 起動時に表示したいViewController
    window = UIWindow(frame: UIScreen.main.bounds)
    window?.rootViewController = rootVC
    window?.makeKeyAndVisible()
    return true
}
  • sceneDelegate.swiftを編集する場合とAppDelegate.swiftを編集する方法がありますが、前者はここでは割愛します

5. 従来のバージョンとの変更点

  • 従来のバージョンだとInfo.plistのStoryboard Nameを削除したり、Main Interfaceを削除しないといけなかったですが、XCode15.0からは若干シンプルになったように感じます
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?