<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vitaly Ishkulov on Medium]]></title>
        <description><![CDATA[Stories by Vitaly Ishkulov on Medium]]></description>
        <link>https://medium.com/@iband?source=rss-435aa61ff7b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*PwUeiljMP6BoVDBF.jpg</url>
            <title>Stories by Vitaly Ishkulov on Medium</title>
            <link>https://medium.com/@iband?source=rss-435aa61ff7b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 02:59:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iband/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Start using Vapor 4 without Toolbox / Homebrew]]></title>
            <link>https://medium.com/@iband/start-using-vapor-4-without-toolbox-homebrew-28564fea1741?source=rss-435aa61ff7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/28564fea1741</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[install]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[vapor]]></category>
            <dc:creator><![CDATA[Vitaly Ishkulov]]></dc:creator>
            <pubDate>Wed, 29 Dec 2021 02:53:25 GMT</pubDate>
            <atom:updated>2021-12-29T02:53:25.031Z</atom:updated>
            <content:encoded><![CDATA[<p>The easiest way to use Vapor is through Vapor Toolbox, but if for some reason you want to install it manually you can do that by creating a new Swift Package.</p><h3>Create a new package</h3><p>Vapor uses Swift Package Manager (SPM) to build the project’s source code and dependencies. So let’s start by creating a new package:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aoVewDLrqVqzU66CaQNQCA.png" /><figcaption>Create a new Swift Package using Xcode.</figcaption></figure><p>You can also generate a new package using terminal:</p><pre>mkdir App &amp;&amp; cd App<br>swift package init --type executable</pre><p>The result will be slightly different since using Xcode doesn’t create executable target automatically, but well edit the manifest, so don’t worry about the difference now.</p><h3>Package Manifest</h3><p>Open Package.swift which contains versions, targets, platforms, packages, dependencies, and other settings of your projects. You can read about each of them in <a href="https://docs.vapor.codes/4.0/spm/">Vapor Docs</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c393a40b08ed52f31a14c4a19de5c41/href">https://medium.com/media/6c393a40b08ed52f31a14c4a19de5c41/href</a></iframe><p>First, we need to add a few dependencies and a target. <br>Add .package(url: &quot;https://github.com/vapor/vapor.git&quot;, from: &quot;4.0.0&quot;), to the dependencies:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/35999591b55cd277d1e303e7e01ed667/href">https://medium.com/media/35999591b55cd277d1e303e7e01ed667/href</a></iframe><p>Note that after you include Vapor dependency, SPM will download all the required packages. The packages will be cached in DerivedData under your project name. You can find it in your library using this command in Terminal:</p><pre>open ~/Library/Developer/Xcode/DerivedData</pre><p>The first time you build your project, SPM will create a Package.resolved file that stores the version of each dependency. The next time you build your project, these same versions will be used even if newer versions are available.</p><p>To update your dependencies, run swift package update.</p><p>Now let’s add the Vapor package to our target, so we can use it. We are going to add Run target and make it executable. Since executable targets cannot be imported by other modules we need to have both an App and a Run target.</p><p>Add Vapor dependency to App target and new Run target dependent on App:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c429198a1d6473e4f7cc9a09718cff28/href">https://medium.com/media/c429198a1d6473e4f7cc9a09718cff28/href</a></iframe><p>We need to do one more thing before we can create our modules and run the server. If you try to import Vapor now, you will get an error:</p><blockquote>Compiling for macOS 10.10, but module ‘Vapor’ has a minimum deployment target of macOS 10.15.</blockquote><p>To fix it add a minimum platform version after name: &quot;App&quot; in Package.swift:</p><pre>name: &quot;App&quot;,<br>platforms: [<br>    .macOS(&quot;10.15&quot;),<br>],</pre><h3>Project structure</h3><p>Vapor documentation has a detailed view of the app structure. We are going to create a bare minimum to run our app.</p><p>Under Sources/ directory create the following structure:</p><pre>Sources/<br>  App/<br>    configure.swift     <br>    routes.swift<br>  Run/<br>    main.swift // Entry point for all Swift apps</pre><p>Now add this code to main.swift:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37d5d94ef7411f6170ac8c9f9f34bc94/href">https://medium.com/media/37d5d94ef7411f6170ac8c9f9f34bc94/href</a></iframe><p>Add the following in routes.swift:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2c01ff82d2038470bd089c57f5b861a/href">https://medium.com/media/b2c01ff82d2038470bd089c57f5b861a/href</a></iframe><p>And configure your app to use the route we just created:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6658f3625be8cce7a9debb8dc0e01f9/href">https://medium.com/media/e6658f3625be8cce7a9debb8dc0e01f9/href</a></iframe><p>Now you can select Run &gt; MyMac target and build your project that should compile without errors or warnings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lp8OREw4yU8-_wIZ7z1aCw.png" /></figure><p>You can run your server from the command line:</p><pre>.build/debug/Run serve</pre><p>But if you want to run it from Xcode add serve argument to be passed on launch:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2-x1_wJ6mBJqT_EnNDMlQA.png" /></figure><p>Now you can run and see the output in Xcode’s console. <br>Click <strong>Run</strong> and open <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28564fea1741" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>