LoginSignup
11
8

More than 5 years have passed since last update.

[Swift3.0] Storyboardを使わない方法

Last updated at Posted at 2017-01-24

Swift超初心者なので、Swift超初心者なりにつまずいた点を記載します。
I'm a biginner at using Swift,so let me share some of the difficulties that I had to go through as a biginner.

ついでに英語の勉強を兼ねていますので、間違っている点がありましたらぜひご指摘ください。
Also, I'm studying English currently,so please correct me if any of my grammar is wrong.

Storyboardを使わずにコーディンしようとした時に、Storyboardファイルを削除するだけではダメだったのでここに記します。
When I tried programming without using Storyboard,erasing the Storyboard file was not enough to solve the error.So, let's check it out.

参考にさせていただいたサイト
This is the website that I referred to.
XcodeのプロジェクトからStoryboardを削除して取り除く方法

Screen Shot 0029-01-24 at 6.36.43 PM.png
「Single View Application」でプロジェクトを作成します。
And create Project using 'Single View Application'.

Screen Shot 0029-01-24 at 6.42.08 PM.png
「Main.storyboard」「LaunchScreen.storyboard」「Assets.xcassets」の3つのファイルを削除します。
And delete three files "Main.storyboard" "LaunchScreen.storyboard" "Assets.xcassets".

Screen Shot 0029-01-24 at 6.46.11 PM.png
「info.plist」ファイルの「Launch screen interface file base name」「Main storyboard file base name」の2つを削除します。
And delete two files "Launch screen interface file base name" "Main storyboard file base name" in info.plist

この状態で一旦ビルド(cmd+r)します。
In this case,first we build.

Screen Shot 0029-01-24 at 6.48.35 PM.png
画像がないとエラーがでますので、エラーメッセージをクリックします。

Without an image,we encounter an error,so click on the error message.

ダイアログが表示されますので、「Add」をクリックしてxcodeに自動で画像を作ってもらいます。
Once the dialog appears, click "add" and then a image has made by the xcode automatically.

de.png
「AppDelegate.swift」に下記のコードを追記します。
Insert coding below in AppDelegate.swift.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

// ここに追記

}
window = UIWindow(frame: UIScreen.main.bounds)
window!.backgroundColor = UIColor.white
window!.rootViewController = ViewController()
window!.makeKeyAndVisible()

ビルドしたらstoryboardがない状態でコーディングが開始できるはずです。
The once you build,the coding begins without any Storyboard.
よろしくお願いいたします。
Thanks you.

11
8
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
11
8