{"id":2894,"date":"2020-08-06T15:03:45","date_gmt":"2020-08-06T15:03:45","guid":{"rendered":"http:\/\/4310.mynmi.net\/?page_id=2894"},"modified":"2026-04-23T21:20:49","modified_gmt":"2026-04-23T21:20:49","slug":"lesson-one","status":"publish","type":"page","link":"https:\/\/nmi.cool\/appdev\/lesson-one\/","title":{"rendered":"Lesson One"},"content":{"rendered":"<p>Many exercises in this course are sourced from various other resources, but this one is homemade with love to get us started with a simple activity that showcases how easy it can be to get an app (albeit a basic one) up and running. In this exercise you will create this basic app which will contain a series of links that lead to screens of different colors. We won&#8217;t really get into detailed explanations of what is actually going on in this lesson (that will come with time young Jedi). Rather, its core purpose is to get you loosely aquatinted with Xcode and the general dev process. But don&#8217;t worry. The other lessons that come after this one will cover all of these topics and much, much more. So get hype, your journey to becoming an App Dev wizard begins here.?<\/p><h2 class=\"wp-block-heading\">Set Up Your Project<\/h2><ol class=\"wp-block-list\"><li>Open Xcode (Finder &gt; Applications). If you&#8217;re working on your own computer, make sure that you have the <a href=\"https:\/\/developer.apple.com\/support\/xcode\/\" target=\"_blank\" rel=\"noreferrer noopener\">most up-to-date version<\/a>. If you have an earlier version, please update. If you are having a bad day, you may also need to upgrade your operating system before you can use the latest version of Xcode. <strong>Note:<\/strong> You&#8217;re not required to have any Beta version of Xcode at this point.<\/li><li>Now create a new project by clicking on &#8220;Create New File&#8221; in the popup or by navigating to File &gt; New &gt; Project.<br><br><img loading=\"lazy\" decoding=\"async\" width=\"1484\" height=\"924\" class=\"wp-image-3612\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/CreateNewProjectUI.png\" alt=\"Xcode 15.4 welcome screen with options to create new project, clone Git repository, or open existing project\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/CreateNewProjectUI.png 1484w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/CreateNewProjectUI-300x187.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/CreateNewProjectUI-1024x638.png 1024w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/CreateNewProjectUI-768x478.png 768w\" sizes=\"auto, (max-width: 1484px) 100vw, 1484px\" \/><br><br><figure><img loading=\"lazy\" decoding=\"async\" width=\"1166\" height=\"422\" class=\"alignnone size-full wp-image-2895 \" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2aecdae2830.png\" alt=\"Xcode File menu open showing New, Add Files, Open, Open Recent, and Close options with keyboard shortcuts displayed\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2aecdae2830.png 1166w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2aecdae2830-300x109.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2aecdae2830-1024x371.png 1024w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2aecdae2830-768x278.png 768w\" sizes=\"auto, (max-width: 1166px) 100vw, 1166px\" \/><\/figure><\/li><li>Make sure iOS<strong> <\/strong>is selected, select App, and click the Next button.<br><br><img loading=\"lazy\" decoding=\"async\" width=\"466\" height=\"321\" class=\"alignnone wp-image-3173 \" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2021\/08\/img_612004d507a93.png\" alt=\"Xcode project template selection screen showing iOS platform with App and Document App options available.\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2021\/08\/img_612004d507a93.png 598w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2021\/08\/img_612004d507a93-300x207.png 300w\" sizes=\"auto, (max-width: 466px) 100vw, 466px\" \/><br><br><\/li><li>As shown below, name your project (Lesson One suffices). Then provide the following:<ol class=\"wp-block-list\"><li>An Organization Identifier. If you have a website, you can base the identifier on your domain name. If not, choose anything you wish (like your name). However, you do need to follow a certain naming convention. I know it feels odd, but your Identifier should start with the suffix first, as in com.google (rather than google.com).<\/li><li>To create a team, you will login to your Apple account and select the Team with your name. <strong>Note:<\/strong> You don&#8217;t have to assign a Team unless you&#8217;re putting the app on an iPhone. So, the Team is optional at this point. <\/li><li>Make sure the Interface is SwiftUI and the language is Swift. You can leave storage as None.<\/li><\/ol><\/li><li>Click Next and save it in the desired location. File created!<br><br><img loading=\"lazy\" decoding=\"async\" width=\"734\" height=\"524\" class=\"wp-image-3613\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.39.07\u202fPM.png\" alt=\"New project options form with Product Name &quot;Lesson One&quot;, Team &quot;Chris Gerlach (Personal Team)&quot;, Organization Identifier &quot;com.glachandco&quot;, SwiftUI Interface, Swift Language, and Include Tests checkbox selected.\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.39.07\u202fPM.png 734w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.39.07\u202fPM-300x214.png 300w\" sizes=\"auto, (max-width: 734px) 100vw, 734px\" \/><br><br><\/li><\/ol><h2 class=\"wp-block-heading\">Get Familiar with Xcode<\/h2><ol start=\"6\" class=\"wp-block-list\"><li>At this point you should be looking at the ContentView file on the left and a preview pane on the right.\u00a0 If for some reason you are not seeing the Project Navigator (side panel containing your project files including ContentView), you can reveal it by clicking View &gt; Navigators &gt; Project as shown in the screenshot below. <br><br><img loading=\"lazy\" decoding=\"async\" width=\"484\" height=\"254\" class=\"wp-image-3615\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.46.59\u202fPM.png\" alt=\"Xcode Editor menu showing options including Show Code Review, Change Editor Orientation, and Show Quick Actions, with Navigators submenu expanded below.\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.46.59\u202fPM.png 484w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.46.59\u202fPM-300x157.png 300w\" sizes=\"auto, (max-width: 484px) 100vw, 484px\" \/><br><br>When everything is set up properly, your Xcode display should look similar to the one below.<br><br><img loading=\"lazy\" decoding=\"async\" width=\"1252\" height=\"765\" class=\"wp-image-3616\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.56.46\u202fPM.png\" alt=\"Xcode editor displaying ContentView.swift with SwiftUI code creating a VStack with a globe icon, &quot;Hello, world!&quot; text, and padding. iPhone 15 Pro simulator preview shows the rendered app with centered text.\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.56.46\u202fPM.png 1252w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.56.46\u202fPM-300x183.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.56.46\u202fPM-1024x626.png 1024w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-6.56.46\u202fPM-768x469.png 768w\" sizes=\"auto, (max-width: 1252px) 100vw, 1252px\" \/><br><figure><p id=\"JpYIiBm\"><\/p><\/figure><\/li><li>The preview of your place filler app should appear on the right second after a few seconds. If you don&#8217;t see anything in the preview on the right, click the Resume button at the top of the content pane. The words &#8220;Hello World&#8221; should display in a background that looks like a phone.<\/li><\/ol><h2 class=\"wp-block-heading\">Create Your Color Views<\/h2><ol start=\"8\" class=\"wp-block-list\"><li>Now, it&#8217;s time to create some new views that we can link to from the first view. Select File, New, File from Template  (or use the keyboard shortcut Command + N), make sure that <strong>SwiftUI View<\/strong> is highlighted and click Next.<br><br><img loading=\"lazy\" decoding=\"async\" width=\"1456\" height=\"428\" class=\"alignnone size-full wp-image-2903 \" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2af8d1d2d88.png\" alt=\"Xcode template selection panel showing User Interface options: Storyboard, SwiftUI View (highlighted), View, Empty, and Launch Screen.\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2af8d1d2d88.png 1456w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2af8d1d2d88-300x88.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2af8d1d2d88-1024x301.png 1024w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2af8d1d2d88-768x226.png 768w\" sizes=\"auto, (max-width: 1456px) 100vw, 1456px\" \/><br><br><\/li><li>Name the file &#8220;one&#8221;, save it, and create three more named two, three, and four. Fun fact: If you look at the file inside your project folder, it will be titled one.swift, two.swift, etc, as it appends &#8220;.swift&#8221; on the file automatically.<\/li><li>Open one.swift (click &#8220;one&#8221; in the project nav if it&#8217;s not already selected) and add a ZStack around the Hello World text with its background color set to purple. Later on, you will learn a LOT about ZStacks; for now, just put one to work by modifying the code to look like the following:<br><br><figure><img loading=\"lazy\" decoding=\"async\" width=\"513\" height=\"223\" class=\"alignnone wp-image-2906 \" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b0143a76d4.png\" alt=\"SwiftUI struct displaying purple-colored &quot;Hello, World!&quot; text using ZStack and Text components.\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b0143a76d4.png 1004w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b0143a76d4-300x130.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b0143a76d4-768x334.png 768w\" sizes=\"auto, (max-width: 513px) 100vw, 513px\" \/><\/figure><br><\/li><li>Change the text from Hello World to Purple.<br><br><figure><img loading=\"lazy\" decoding=\"async\" width=\"326\" height=\"50\" class=\"alignnone wp-image-2993 \" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f45302ca2684.png\" alt=\"Text function with &quot;Purple&quot; parameter displayed in SwiftUI code syntax\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f45302ca2684.png 444w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f45302ca2684-300x46.png 300w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/figure><p id=\"CRucFIn\"><\/p><\/li><li>Repeat the process for views two, three, and four, using a different color for each one.<\/li><\/ol><h2 class=\"wp-block-heading\">Add Navigation Links<\/h2><ol start=\"13\" class=\"wp-block-list\"><li>Return to ContentView.swift and, using the screen capture as a guide, create a link to one.swift (the one with the purple background). To do this, replace everything in the VStack brackets (Image + Text) with the NavigationLink as seen below. Notice that the destination is set to one.swift (without &#8220;.swift&#8221; written out) and the link text is &#8220;Purple,&#8221; as that is the page we are linking to.<br><br><img loading=\"lazy\" decoding=\"async\" width=\"850\" height=\"249\" class=\"wp-image-3682\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-18-at-11.51.51\u202fPM.png\" alt=\"SwiftUI VStack containing a NavigationLink to one() with purple text label\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-18-at-11.51.51\u202fPM.png 850w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-18-at-11.51.51\u202fPM-300x88.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-18-at-11.51.51\u202fPM-768x225.png 768w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><br><\/li><li>One more thing. Before your link will actually work, you have to wrap a Navigation View around it. Like this:<br><br><img loading=\"lazy\" decoding=\"async\" width=\"726\" height=\"248\" class=\"wp-image-3683\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-18-at-11.55.44\u202fPM.png\" alt=\"SwiftUI VStack containing NavigationView with NavigationLink to one() destination labeled &quot;Purple\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-18-at-11.55.44\u202fPM.png 726w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-18-at-11.55.44\u202fPM-300x102.png 300w\" sizes=\"auto, (max-width: 726px) 100vw, 726px\" \/><p id=\"tqTwouv\"><\/p><\/li><\/ol><h2 class=\"wp-block-heading\">Test and Polish<\/h2><ol start=\"15\" class=\"wp-block-list\"><li>If you don&#8217;t see the live preview already, click the live preview <img loading=\"lazy\" decoding=\"async\" width=\"43\" height=\"40\" class=\"wp-image-2910 alignnone\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b215c92626.png\" alt=\"Blue play button icon centered in a circle outline\"> button at bottom left of your preview pane. As soon as you are able to (live preview takes a few moments to crank up), test your link. Hopefully the purple screen appears! Make sure your simulator is set for an iOS device via the dropdown below the preview (see pic below). <br><br><img loading=\"lazy\" decoding=\"async\" width=\"489\" height=\"117\" class=\"wp-image-3617\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-7.31.29\u202fPM.png\" alt=\"Xcode toolbar showing device selection dropdown set to &quot;Automatic \u2013 iPhone 15 Pro&quot; with preview and inspection tool icons\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-7.31.29\u202fPM.png 489w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-06-at-7.31.29\u202fPM-300x72.png 300w\" sizes=\"auto, (max-width: 489px) 100vw, 489px\" \/><br><br><\/li><li>Did it work? Great! Now, it&#8217;s time to add a new link. Before we add anything new, however, we have to add another &#8216;container&#8217; or in SwiftUI terms, &#8216;stack.&#8217;<br>There are three types of stacks: Vertical Stacks (VStack), Horizontal Stacks (HStack), and the ZStack that you recently used. In this case we are going with the VStack. You could &#8216;hand code&#8217; the VStack, but we are going to create it the easy way. <img loading=\"lazy\" decoding=\"async\" width=\"371\" height=\"178\" class=\"wp-image-2911 alignright\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b230a47673.png\" alt=\"Xcode refactoring menu showing options including Embed in VStack, Group, Make Conditional, and Extract to Variable, with NavigationLink code highlighted below.\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b230a47673.png 1268w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b230a47673-300x144.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b230a47673-1024x493.png 1024w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b230a47673-768x369.png 768w\" sizes=\"auto, (max-width: 371px) 100vw, 371px\" \/><strong><br>Control + click<\/strong> (or right click if available) on the word NavigationLink and select Embed in VStack.<\/li><li>That&#8217;s it! Your new VStack should contain the NavigationLink as shown below.<br><img loading=\"lazy\" decoding=\"async\" width=\"792\" height=\"278\" class=\"wp-image-3684\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.00.34\u202fAM.png\" alt=\"SwiftUI NavigationView containing a VStack with a NavigationLink to one() displaying &quot;Purple&quot; text\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.00.34\u202fAM.png 792w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.00.34\u202fAM-300x105.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.00.34\u202fAM-768x270.png 768w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><br><br><\/li><li>Add a new NavigationLink to two.swift below the first one. I suggest that you copy, paste and modify the first one. When you are done, your code should look like this (although you may have a color other than yellow).<br><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"382\" class=\"wp-image-3685\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.02.24\u202fAM.png\" alt=\"SwiftUI NavigationView with VStack containing two NavigationLinks labeled Purple and Yellow\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.02.24\u202fAM.png 786w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.02.24\u202fAM-300x146.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.02.24\u202fAM-768x373.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><br><\/li><li>Once that works, add the additional links to th<img loading=\"lazy\" decoding=\"async\" width=\"204\" height=\"231\" class=\"wp-image-2914 alignright\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b266ca71c0.png\" alt=\"Color list displaying Purple, Yellow, Red, and Green text in their respective colors\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b266ca71c0.png 270w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2020\/08\/img_5f2b266ca71c0-265x300.png 265w\" sizes=\"auto, (max-width: 204px) 100vw, 204px\" \/>ree and four.<br><br>Congrats! At this point you should have a functional, and funky, app that connects all five views and is easily navigable. But wouldn&#8217;t it be cool if your links were larger and matched the color of the view they link to like the image at right?\u00a0 Fortunately that goal is easily attainable! Simply click on the word Text, as in Text(&#8220;Purple&#8221;) and use the Attribute Inspector (Don&#8217;t see it? View &gt; Inspectors &gt; Attributes) to set the size to Large Title (see screenshot below). Then set the font color to whatever you choose. Repeat the process three more times and you are done! <br><p id=\"YqJXUQn\"><\/p><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"1025\" class=\"wp-image-3688\" style=\"width: 550px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.08.35\u202fAM.png\" alt=\"Xcode inspector panel showing text formatting options for a Purple element with Font, Accessibility, Padding, and Modifiers settings.\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.08.35\u202fAM.png 800w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.08.35\u202fAM-234x300.png 234w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.08.35\u202fAM-768x984.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><br><\/li><li>But wait! Wouldn&#8217;t it be nice if those links were aligned to the left? Easy. Simply click on VStack and use the attribute inspector at right to re-align everything that is inside of the VStack.<br><br><img loading=\"lazy\" decoding=\"async\" width=\"2720\" height=\"1560\" class=\"wp-image-3689\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.12.19\u202fAM.png\" alt=\"Xcode ContentView.swift editor showing SwiftUI NavigationView with four NavigationLinks displaying Purple, Yellow, Red, and Green text in matching colors\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.12.19\u202fAM.png 2720w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.12.19\u202fAM-300x172.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.12.19\u202fAM-1024x587.png 1024w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.12.19\u202fAM-768x440.png 768w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.12.19\u202fAM-1536x881.png 1536w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.12.19\u202fAM-2048x1175.png 2048w\" sizes=\"auto, (max-width: 2720px) 100vw, 2720px\" \/><br><\/li><li>Still confused? Your final NavigationView code should look like this:<br><br><pre class=\"wp-block-code\"><code>VStack {\n    NavigationView{\n        VStack(alignment: .leading) {\n            NavigationLink(destination: one()){\n                Text(\"Purple\")\n                    .font(.largeTitle)\n                    .foregroundColor(Color.purple)\n            }\n            NavigationLink(destination: two()){\n                Text(\"Yellow\")\n                    .font(.largeTitle)\n                    .foregroundStyle(.yellow)\n            }\n            NavigationLink(destination: three()){\n                Text(\"Red\")\n                    .font(.largeTitle)\n                    .foregroundStyle(.red)\n            }\n            NavigationLink(destination: four()){\n                Text(\"Green\")\n                    .font(.largeTitle)\n                    .foregroundStyle(.green)\n            }\n        }\n    }\n}<\/code><\/pre><p id=\"UdiLLHH\"><\/p><\/li><\/ol><h2 class=\"wp-block-heading\">Going Further (Optional)<\/h2><ol start=\"22\" class=\"wp-block-list\"><li>Have a little extra time? Let&#8217;s insert your face in this app! Find an image of you.<ol class=\"wp-block-list\"><li>make sure it is jpg format<\/li><li>size it to approximately 800px width and name it me.jpg<\/li><li>via Project Navigator, click on Assets, then drag and drop your photo into Xcode.<br><img loading=\"lazy\" decoding=\"async\" width=\"1126\" height=\"516\" class=\"wp-image-3700\" style=\"width: 800px\" src=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.24.53\u202fAM.png\" alt=\"Xcode Assets folder view showing AccentColor and AppIcon assets, with me file selected and highlighted in blue.\" srcset=\"https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.24.53\u202fAM.png 1126w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.24.53\u202fAM-300x137.png 300w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.24.53\u202fAM-1024x469.png 1024w, https:\/\/nmi.cool\/appdev\/wp-content\/uploads\/sites\/17\/2024\/08\/Screenshot-2024-08-19-at-12.24.53\u202fAM-768x352.png 768w\" sizes=\"auto, (max-width: 1126px) 100vw, 1126px\" \/><br><p id=\"OnZoOVO\"><\/p><\/li><li>Create yet one more SwiftUI file named five and add the image to it like this: <strong><strong>Image(&#8220;me&#8221;)<\/strong><\/strong><br><br><pre class=\"wp-block-code\"><code>struct five: View {\n    var body: some View {\n        Image(\"me\")\n    }\n}<\/code><\/pre><\/li><li>Link that one up as well.<\/li><\/ol><\/li><li>Still have time? Let&#8217;s connect your phone to your computer via lightning or USBC cable (depending on iPhone model).<\/li><li><a href=\"https:\/\/nmi.cool\/appdev\/launching-on-a-device\/\">Follow these instructions to put the app on your iPhone<\/a>. If you don&#8217;t have an iPhone, just use a simulator.<\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>Many exercises in this course are sourced from various other resources, but this one is homemade with love to get us started with a simple activity that showcases how easy it can be to get an app (albeit a basic one) up and running. In this exercise you will create this basic app which will &hellip; <a href=\"https:\/\/nmi.cool\/appdev\/lesson-one\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Lesson One<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2894","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/nmi.cool\/appdev\/wp-json\/wp\/v2\/pages\/2894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nmi.cool\/appdev\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/nmi.cool\/appdev\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/nmi.cool\/appdev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nmi.cool\/appdev\/wp-json\/wp\/v2\/comments?post=2894"}],"version-history":[{"count":47,"href":"https:\/\/nmi.cool\/appdev\/wp-json\/wp\/v2\/pages\/2894\/revisions"}],"predecessor-version":[{"id":4272,"href":"https:\/\/nmi.cool\/appdev\/wp-json\/wp\/v2\/pages\/2894\/revisions\/4272"}],"wp:attachment":[{"href":"https:\/\/nmi.cool\/appdev\/wp-json\/wp\/v2\/media?parent=2894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}