{"id":91,"date":"2017-02-19T21:30:00","date_gmt":"2017-02-19T21:30:00","guid":{"rendered":"https:\/\/seimith.io\/?p=91"},"modified":"2024-07-20T00:26:29","modified_gmt":"2024-07-20T00:26:29","slug":"swift-stop-using-the-storyboard","status":"publish","type":"post","link":"https:\/\/seimith.io\/pt\/2017\/02\/19\/swift-stop-using-the-storyboard\/","title":{"rendered":"(Swift) Stop Using the Storyboard"},"content":{"rendered":"<p>I started learning&nbsp;<code>Swift<\/code>&nbsp;about three months ago and when I started I used the&nbsp;<code>storyboard<\/code>. This post will be a snippet of how you can stop using the&nbsp;<code>storyboard<\/code>!<\/p>\n\n\n\n<p>The major benefit of not using the&nbsp;<code>storyboard<\/code>&nbsp;is not having messy merge conflicts. Long story short, the&nbsp;<code>storyboard<\/code>&nbsp;file is a fairly large&nbsp;<code>xml<\/code>&nbsp;file and every time you open it something changes. Every time, you change a controller, or every time you add an&nbsp;<code>IBOutlet<\/code>&nbsp;or&nbsp;<code>IBAction<\/code>&nbsp;something changes.<\/p>\n\n\n\n<p><strong>Tools:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Swift 3.0<\/li>\n\n\n\n<li>Xcode Version 8.0<\/li>\n<\/ul>\n\n\n\n<p>Within your&nbsp;<code>AppDelegate.swift<\/code>, specify the&nbsp;<code>window<\/code>&nbsp;frame.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var window: UIWindow? = UIWindow(frame: UIScreen.main.bounds)<\/code><\/pre>\n\n\n\n<p>Then, in your&nbsp;<code>application<\/code>&nbsp;function you can specify your main view controller to be something else.<\/p>\n\n\n\n<p>In this example below, I\u2019ve created some other view controller, called&nbsp;<code>NewViewController<\/code>,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: &#91;UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool {\n  let startingViewController = NewViewController()\n  self.window!.rootViewController = startingViewController\n  window!.makeKeyAndVisible()\n  return true\n}<\/code><\/pre>\n\n\n\n<p>At this point, you can delete your&nbsp;<code>Storyboard.main<\/code>&nbsp;file. However, when you build and run your project at this point, you might get an error like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle NSBundle.<\/code><\/pre>\n\n\n\n<p>If this happens, navigate to your&nbsp;<code>info.plist<\/code>&nbsp;and delete the following entry:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Main storyboard file base name | String | Main<\/code><\/pre>\n\n\n\n<p>Hard clean and rebuild and you should see your new view controller.<\/p>","protected":false},"excerpt":{"rendered":"<p>I started learning&nbsp;Swift&nbsp;about three months ago and when I started I used the&nbsp;storyboard. This post will be a snippet of how you can stop using the&nbsp;storyboard! The major benefit of not using the&nbsp;storyboard&nbsp;is not having messy merge conflicts. Long story short, the&nbsp;storyboard&nbsp;file is a fairly large&nbsp;xml&nbsp;file and every time you open it something changes. Every [&hellip;]<\/p>","protected":false},"author":1,"featured_media":288,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[20],"class_list":["post-91","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-post","tag-code"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>(Swift) Stop Using the Storyboard - S(ei)mith.io<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/seimith.io\/pt\/2017\/02\/19\/swift-stop-using-the-storyboard\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"(Swift) Stop Using the Storyboard - S(ei)mith.io\" \/>\n<meta property=\"og:description\" content=\"I started learning&nbsp;Swift&nbsp;about three months ago and when I started I used the&nbsp;storyboard. This post will be a snippet of how you can stop using the&nbsp;storyboard! The major benefit of not using the&nbsp;storyboard&nbsp;is not having messy merge conflicts. Long story short, the&nbsp;storyboard&nbsp;file is a fairly large&nbsp;xml&nbsp;file and every time you open it something changes. Every [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/seimith.io\/pt\/2017\/02\/19\/swift-stop-using-the-storyboard\/\" \/>\n<meta property=\"og:site_name\" content=\"S(ei)mith.io\" \/>\n<meta property=\"article:published_time\" content=\"2017-02-19T21:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-20T00:26:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"700\" \/>\n\t<meta property=\"og:image:height\" content=\"700\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Smith\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Smith\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/\"},\"author\":{\"name\":\"Smith\",\"@id\":\"https:\\\/\\\/seimith.io\\\/#\\\/schema\\\/person\\\/315065130ef0017986daf9a1127ce80a\"},\"headline\":\"(Swift) Stop Using the Storyboard\",\"datePublished\":\"2017-02-19T21:30:00+00:00\",\"dateModified\":\"2024-07-20T00:26:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/\"},\"wordCount\":187,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"keywords\":[\"Code\"],\"articleSection\":[\"Post\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/\",\"url\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/\",\"name\":\"(Swift) Stop Using the Storyboard - S(ei)mith.io\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"datePublished\":\"2017-02-19T21:30:00+00:00\",\"dateModified\":\"2024-07-20T00:26:29+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/#\\\/schema\\\/person\\\/315065130ef0017986daf9a1127ce80a\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/#primaryimage\",\"url\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"contentUrl\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"width\":700,\"height\":700},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2017\\\/02\\\/19\\\/swift-stop-using-the-storyboard\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/seimith.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"(Swift) Stop Using the Storyboard\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/seimith.io\\\/#website\",\"url\":\"https:\\\/\\\/seimith.io\\\/\",\"name\":\"s(ei)mith.io\",\"description\":\"Ramblings written by\u00a0Smith Suth\u00a0who works at the intersection of Engineering, Product, and Design.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/seimith.io\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/seimith.io\\\/#\\\/schema\\\/person\\\/315065130ef0017986daf9a1127ce80a\",\"name\":\"Smith\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g\",\"caption\":\"Smith\"},\"sameAs\":[\"https:\\\/\\\/seimith.io\"],\"url\":\"https:\\\/\\\/seimith.io\\\/pt\\\/author\\\/seimithsuth\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"(Swift) Stop Using the Storyboard - S(ei)mith.io","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/seimith.io\/pt\/2017\/02\/19\/swift-stop-using-the-storyboard\/","og_locale":"pt_BR","og_type":"article","og_title":"(Swift) Stop Using the Storyboard - S(ei)mith.io","og_description":"I started learning&nbsp;Swift&nbsp;about three months ago and when I started I used the&nbsp;storyboard. This post will be a snippet of how you can stop using the&nbsp;storyboard! The major benefit of not using the&nbsp;storyboard&nbsp;is not having messy merge conflicts. Long story short, the&nbsp;storyboard&nbsp;file is a fairly large&nbsp;xml&nbsp;file and every time you open it something changes. Every [&hellip;]","og_url":"https:\/\/seimith.io\/pt\/2017\/02\/19\/swift-stop-using-the-storyboard\/","og_site_name":"S(ei)mith.io","article_published_time":"2017-02-19T21:30:00+00:00","article_modified_time":"2024-07-20T00:26:29+00:00","og_image":[{"width":700,"height":700,"url":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","type":"image\/webp"}],"author":"Smith","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Smith","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/#article","isPartOf":{"@id":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/"},"author":{"name":"Smith","@id":"https:\/\/seimith.io\/#\/schema\/person\/315065130ef0017986daf9a1127ce80a"},"headline":"(Swift) Stop Using the Storyboard","datePublished":"2017-02-19T21:30:00+00:00","dateModified":"2024-07-20T00:26:29+00:00","mainEntityOfPage":{"@id":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/"},"wordCount":187,"commentCount":0,"image":{"@id":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/#primaryimage"},"thumbnailUrl":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","keywords":["Code"],"articleSection":["Post"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/","url":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/","name":"(Swift) Stop Using the Storyboard - S(ei)mith.io","isPartOf":{"@id":"https:\/\/seimith.io\/#website"},"primaryImageOfPage":{"@id":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/#primaryimage"},"image":{"@id":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/#primaryimage"},"thumbnailUrl":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","datePublished":"2017-02-19T21:30:00+00:00","dateModified":"2024-07-20T00:26:29+00:00","author":{"@id":"https:\/\/seimith.io\/#\/schema\/person\/315065130ef0017986daf9a1127ce80a"},"breadcrumb":{"@id":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/#primaryimage","url":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","contentUrl":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","width":700,"height":700},{"@type":"BreadcrumbList","@id":"https:\/\/seimith.io\/2017\/02\/19\/swift-stop-using-the-storyboard\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/seimith.io\/"},{"@type":"ListItem","position":2,"name":"(Swift) Stop Using the Storyboard"}]},{"@type":"WebSite","@id":"https:\/\/seimith.io\/#website","url":"https:\/\/seimith.io\/","name":"s(ei)mith.io","description":"Ramblings written by\u00a0Smith Suth\u00a0who works at the intersection of Engineering, Product, and Design.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/seimith.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Person","@id":"https:\/\/seimith.io\/#\/schema\/person\/315065130ef0017986daf9a1127ce80a","name":"Smith","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/secure.gravatar.com\/avatar\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g","caption":"Smith"},"sameAs":["https:\/\/seimith.io"],"url":"https:\/\/seimith.io\/pt\/author\/seimithsuth\/"}]}},"_links":{"self":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/comments?post=91"}],"version-history":[{"count":1,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":92,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts\/91\/revisions\/92"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/media\/288"}],"wp:attachment":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/media?parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/categories?post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/tags?post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}