[{"data":1,"prerenderedAt":434},["ShallowReactive",2],{"Categories":3,"NavIndexCategoriesCountFooter":203,"content-\u002F2020\u002F03\u002F02\u002Fswiftui-project-setup\u002F":204},[4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,68,70,71,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202],{"category":5},"System Administration",{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},"Software Development",{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":27},{"category":27},{"category":67},"Drones & RC",{"category":69},"DIY Projects",{"category":67},{"category":72},"Photography",{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":67},{"category":67},{"category":72},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":5},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":67},{"category":67},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":72},{"category":67},{"category":138},"3D Printing - Laser Cutting - CNC",{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":5},{"category":138},{"category":27},{"category":27},{"category":138},{"category":138},{"category":72},{"category":158},"Photography,3D Printing - Laser Cutting - CNC",{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":67},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":181},"Home Assistant",{"category":181},{"category":72},{"category":27},{"category":27},{"category":72},{"category":138},{"category":5},{"category":72},{"category":72},{"category":138},{"category":27},{"category":181},{"category":181},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},191,{"id":205,"title":206,"body":207,"category":27,"date":417,"description":213,"embedImage":418,"extension":419,"image":248,"intro":213,"meta":420,"navigation":421,"path":422,"seo":423,"series":424,"sitemap":425,"stem":426,"tags":427,"__hash__":433},"content\u002F2020\u002F03\u002F02\u002Fswiftui-project-setup.md","SwiftUI project setup",{"type":208,"value":209,"toc":411},"minimark",[210,214,217,220,225,228,242,249,252,254,258,261,276,339,341,345,348,355,363,370,373,379,386,389,391,395,398,400,407],[211,212,213],"p",{},"Let's start by getting the correct project setup.",[211,215,216],{},"You'll need to be on the latest Xcode (11.3 or so) - and it will be best if you are running Catalina - then we can get the canvas previews in XCode to work.",[218,219],"hr",{},[221,222,224],"h2",{"id":223},"setup","Setup",[211,226,227],{},"In Xcode - start a new project. Choose iOS and a single view app.",[211,229,230,231,241],{},"Fill out the project details. In my case - I will end up keeping the same details as the ",[232,233,240],"a",{"href":234,"rel":235,"target":239},"https:\u002F\u002Fgithub.com\u002Fchrissearle\u002FLommepenger\u002Ftree\u002F63a3bda3183926a18e821d90c62dc33b807c7e33",[236,237,238],"nofollow","noopener","noreferer","_blank","previous version of the app",". Make sure to choose Swift as the language and SwiftUI as the User Interface.",[211,243,244],{},[245,246],"img",{"alt":247,"src":248},"Project Setup","\u002Fimages\u002Fposts\u002F2020\u002F03\u002Fproject-setup.png",[211,250,251],{},"Choose a place to save the project and enable git repository generation.",[218,253],{},[221,255,257],{"id":256},"gitignore",".gitignore",[211,259,260],{},"Xcode's git setup doesn't create a .gitignore file and it does have a bunch of files that we don't really want checked in. So - let's grab one.",[211,262,263,264,269,270,275],{},"GitHub maintains a really useful ",[232,265,268],{"href":266,"rel":267,"target":239},"https:\u002F\u002Fgithub.com\u002Fgithub\u002Fgitignore",[236,237,238],"gitignore repository"," with lots of different templates. We'll grab the ",[232,271,274],{"href":272,"rel":273,"target":239},"https:\u002F\u002Fgithub.com\u002Fgithub\u002Fgitignore\u002Fblob\u002Fmaster\u002FSwift.gitignore",[236,237,238],"Swift"," one and save it as .gitignore in the project (add and commit) before we continue.",[277,278,283],"pre",{"className":279,"code":280,"language":281,"meta":282,"style":282},"language-shell shiki shiki-themes github-dark","$ curl -o .gitignore https:\u002F\u002Fraw.githubusercontent.com\u002Fgithub\u002Fgitignore\u002Fmaster\u002FSwift.gitignore\n$ git add .gitignore\n$ git ci -m \"Add .gitignore\"\n","shell","",[284,285,286,309,323],"code",{"__ignoreMap":282},[287,288,291,295,299,303,306],"span",{"class":289,"line":290},"line",1,[287,292,294],{"class":293},"svObZ","$",[287,296,298],{"class":297},"sU2Wk"," curl",[287,300,302],{"class":301},"sDLfK"," -o",[287,304,305],{"class":297}," .gitignore",[287,307,308],{"class":297}," https:\u002F\u002Fraw.githubusercontent.com\u002Fgithub\u002Fgitignore\u002Fmaster\u002FSwift.gitignore\n",[287,310,312,314,317,320],{"class":289,"line":311},2,[287,313,294],{"class":293},[287,315,316],{"class":297}," git",[287,318,319],{"class":297}," add",[287,321,322],{"class":297}," .gitignore\n",[287,324,326,328,330,333,336],{"class":289,"line":325},3,[287,327,294],{"class":293},[287,329,316],{"class":297},[287,331,332],{"class":297}," ci",[287,334,335],{"class":301}," -m",[287,337,338],{"class":297}," \"Add .gitignore\"\n",[218,340],{},[221,342,344],{"id":343},"libraries","Libraries",[211,346,347],{},"Let's finish up the setup with two libraries we already know we want to add.",[211,349,350,351,354],{},"In Xcode - choose ",[284,352,353],{},"File > Swift Packages > Add Package Dependency",".",[211,356,357,358,362],{},"In the package repository url field - enter ",[232,359,360],{"href":360,"rel":361,"target":239},"https:\u002F\u002Fgithub.com\u002FAlamofire\u002FAlamofire.git",[236,237,238]," and hit next.",[211,364,365,366,369],{},"For version rule - keep ",[284,367,368],{},"Up to next major"," and next again.",[211,371,372],{},"In the final window - make sure that the package is checked off for your app's target and hit finish.",[211,374,375],{},[245,376],{"alt":377,"src":378},"Add package confirmation","\u002Fimages\u002Fposts\u002F2020\u002F03\u002Fadd-package.png",[211,380,381,382],{},"Now do the same with ",[232,383,384],{"href":384,"rel":385,"target":239},"https:\u002F\u002Fgithub.com\u002Ftwostraws\u002FCodeScanner.git",[236,237,238],[211,387,388],{},"Finally git add and commit the changes.",[218,390],{},[221,392,394],{"id":393},"summary","Summary",[211,396,397],{},"The project is now ready to use - in the next step we'll start by testing out QR code scanning.",[218,399],{},[211,401,402],{},[232,403,406],{"href":404,"rel":405,"target":239},"https:\u002F\u002Fgithub.com\u002Fchrissearle\u002Flommepenger-swiftui",[236,237,238],"GitHub Repository",[408,409,410],"style",{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":282,"searchDepth":311,"depth":311,"links":412},[413,414,415,416],{"id":223,"depth":311,"text":224},{"id":256,"depth":311,"text":257},{"id":343,"depth":311,"text":344},{"id":393,"depth":311,"text":394},"2020-03-02 20:54 +0100",null,"md",{},true,"\u002F2020\u002F03\u002F02\u002Fswiftui-project-setup",{"title":206,"description":213},"Revisiting the Sbanken API with SwiftUI",{"loc":422},"2020\u002F03\u002F02\u002Fswiftui-project-setup",[428,429,430,431,432],"ios","swift","swiftui","xcode","tutorial","E0CktKsywHpakNZIth5O5jUsrYqvCCKT-jLMtCQ4L-0",1775293006915]