{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Xcode","type":"basic","slug":"xcode","excerpt":"","body":"Xcode makes programming in Swift faster and more intuitive. You can build and run your Vapor project from inside of Xcode, use code autocompletion, and option-click for documentation. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Generate Xcode Project\"\n}\n[/block]\nTo generate and open the Xcode project, run the following command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"vapor xcode\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Select Toolchain\"\n}\n[/block]\nMake sure you have the correct toolchain selected by going to Xcode > Toolchains.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/wL3bWD0IRLysc1ACVm7e_Screen%20Shot%202016-06-09%20at%2012.58.21%20PM.png\",\n        \"Screen Shot 2016-06-09 at 12.58.21 PM.png\",\n        \"696\",\n        \"405\",\n        \"#2d5d91\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nVapor `0.11` uses the `06-06 (a)` toolchain. \n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Wrong Toolchain\",\n  \"body\": \"Apple makes breaking changes between snapshots. If you use the wrong toolchain, Vapor will most likely not compile.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Build and Run\"\n}\n[/block]\nSelect App from the list of schemes and press `Command+R` or hit the play button to build and run your project.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/G56uiN3LTXmyLy28PqkL_Screen%20Shot%202016-05-07%20at%201.21.51%20AM.png\",\n        \"Screen Shot 2016-05-07 at 1.21.51 AM.png\",\n        \"274\",\n        \"76\",\n        \"#8d4111\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nIf all goes well, you should see the following printed out in Xcode's console:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/PgZ0zDXmTDWnEKm8wtEW_Screen%20Shot%202016-05-07%20at%201.25.27%20AM.png\",\n        \"Screen Shot 2016-05-07 at 1.25.27 AM.png\",\n        \"1058\",\n        \"242\",\n        \"#3077cb\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Arguments\"\n}\n[/block]\nYou can pass arguments to the executable through Xcode just as you would through the command line.\n\nSelect Edit Scheme... from the scheme list while `App` is selected.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/DHh3IQjFQPm8oEPDS5wm_Screen%20Shot%202016-05-07%20at%201.25.52%20AM.png\",\n        \"Screen Shot 2016-05-07 at 1.25.52 AM.png\",\n        \"406\",\n        \"364\",\n        \"#8e6350\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nFrom there, you can change which arguments are passed on launch.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/EZU6VPK2R8yfrUspRam3_Screen%20Shot%202016-05-07%20at%201.25.56%20AM.png\",\n        \"Screen Shot 2016-05-07 at 1.25.56 AM.png\",\n        \"3026\",\n        \"1978\",\n        \"#bf70c8\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Important Arguments\"\n}\n[/block]\nXcode builds and runs the executable in a temporary folder on your file system. This makes the current working directory of the executable different than what it would normally be if you ran `vapor run serve`.\n\nTo get around this, you should include the following arguments in your Xcode scheme.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/PafCyTEgRxCaiLCx4WpJ_Screen%20Shot%202016-06-09%20at%201.01.22%20PM.png\",\n        \"Screen Shot 2016-06-09 at 1.01.22 PM.png\",\n        \"682\",\n        \"160\",\n        \"#234a80\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"serve\\n--workdir=$(SRCROOT)\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nThe first argument explicitly runs the `serve` command. `serve` runs by default if no command is provided, but this may change in the future. Read more about commands in the Commands section of the Guide.\n\nThe second argument passes an Xcode variable for Source Root as the working directory for Vapor. This will allow all of your views and other static to be properly found and rendered.","updates":[],"order":5,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5768701b72cd4c0e000fad2e","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Getting Started","slug":"documentation","order":0,"from_sync":false,"reference":false,"_id":"5768701b72cd4c0e000fad19","createdAt":"2016-04-09T02:58:48.377Z","__v":0,"project":"57086fe855a4690e005de407","version":"5768701b72cd4c0e000fad18"},"parentDoc":null,"githubsync":"","project":"57086fe855a4690e005de407","version":{"version":"0.12","version_clean":"0.12.0","codename":"Client Clyde","is_stable":false,"is_beta":true,"is_hidden":false,"is_deprecated":true,"categories":["5768701b72cd4c0e000fad19","5768701b72cd4c0e000fad1a","5768701b72cd4c0e000fad1b","5768701b72cd4c0e000fad1c"],"_id":"5768701b72cd4c0e000fad18","releaseDate":"2016-06-20T22:37:15.641Z","__v":1,"createdAt":"2016-06-20T22:37:15.641Z","project":"57086fe855a4690e005de407"},"__v":0,"createdAt":"2016-05-07T04:55:09.809Z","user":"57086f3d447c410e00221bd1"}
Xcode makes programming in Swift faster and more intuitive. You can build and run your Vapor project from inside of Xcode, use code autocompletion, and option-click for documentation. [block:api-header] { "type": "basic", "title": "Generate Xcode Project" } [/block] To generate and open the Xcode project, run the following command: [block:code] { "codes": [ { "code": "vapor xcode", "language": "text" } ] } [/block] [block:api-header] { "type": "basic", "title": "Select Toolchain" } [/block] Make sure you have the correct toolchain selected by going to Xcode > Toolchains. [block:image] { "images": [ { "image": [ "https://files.readme.io/wL3bWD0IRLysc1ACVm7e_Screen%20Shot%202016-06-09%20at%2012.58.21%20PM.png", "Screen Shot 2016-06-09 at 12.58.21 PM.png", "696", "405", "#2d5d91", "" ] } ] } [/block] Vapor `0.11` uses the `06-06 (a)` toolchain. [block:callout] { "type": "warning", "title": "Wrong Toolchain", "body": "Apple makes breaking changes between snapshots. If you use the wrong toolchain, Vapor will most likely not compile." } [/block] [block:api-header] { "type": "basic", "title": "Build and Run" } [/block] Select App from the list of schemes and press `Command+R` or hit the play button to build and run your project. [block:image] { "images": [ { "image": [ "https://files.readme.io/G56uiN3LTXmyLy28PqkL_Screen%20Shot%202016-05-07%20at%201.21.51%20AM.png", "Screen Shot 2016-05-07 at 1.21.51 AM.png", "274", "76", "#8d4111", "" ] } ] } [/block] If all goes well, you should see the following printed out in Xcode's console: [block:image] { "images": [ { "image": [ "https://files.readme.io/PgZ0zDXmTDWnEKm8wtEW_Screen%20Shot%202016-05-07%20at%201.25.27%20AM.png", "Screen Shot 2016-05-07 at 1.25.27 AM.png", "1058", "242", "#3077cb", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Arguments" } [/block] You can pass arguments to the executable through Xcode just as you would through the command line. Select Edit Scheme... from the scheme list while `App` is selected. [block:image] { "images": [ { "image": [ "https://files.readme.io/DHh3IQjFQPm8oEPDS5wm_Screen%20Shot%202016-05-07%20at%201.25.52%20AM.png", "Screen Shot 2016-05-07 at 1.25.52 AM.png", "406", "364", "#8e6350", "" ] } ] } [/block] From there, you can change which arguments are passed on launch. [block:image] { "images": [ { "image": [ "https://files.readme.io/EZU6VPK2R8yfrUspRam3_Screen%20Shot%202016-05-07%20at%201.25.56%20AM.png", "Screen Shot 2016-05-07 at 1.25.56 AM.png", "3026", "1978", "#bf70c8", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Important Arguments" } [/block] Xcode builds and runs the executable in a temporary folder on your file system. This makes the current working directory of the executable different than what it would normally be if you ran `vapor run serve`. To get around this, you should include the following arguments in your Xcode scheme. [block:image] { "images": [ { "image": [ "https://files.readme.io/PafCyTEgRxCaiLCx4WpJ_Screen%20Shot%202016-06-09%20at%201.01.22%20PM.png", "Screen Shot 2016-06-09 at 1.01.22 PM.png", "682", "160", "#234a80", "" ] } ] } [/block] [block:code] { "codes": [ { "code": "serve\n--workdir=$(SRCROOT)", "language": "text" } ] } [/block] The first argument explicitly runs the `serve` command. `serve` runs by default if no command is provided, but this may change in the future. Read more about commands in the Commands section of the Guide. The second argument passes an Xcode variable for Source Root as the working directory for Vapor. This will allow all of your views and other static to be properly found and rendered.