More Related Content More from All Things Open (20) Getting Started with Swift Web Frameworks6. “For the second year in a row Rust,
Swift and Go make the top 5 most
loved programming languages.”
25. Install Swift Version Manager
$ git clone https://github.com/kylef/swiftenv.git
~/.swiftenv
$ echo 'export SWIFTENV_ROOT="$HOME/.swiftenv"' >>
~/.bash_profile
$ echo 'export PATH="$SWIFTENV_ROOT/bin:$PATH"' >>
~/.bash_profile
$ echo 'eval "$(swiftenv init -)"' >> ~/.bash_profile
27. Initialize Your Project
$ mkdir HelloWorld
$ cd HelloWorld
$ swift package init --type executable
Creating executable package: HelloWorld
Creating Package.swift
Creating Sources/
Creating Sources/main.swift
Creating Tests/
28. Add Vapor to your
Package.swift
import PackageDescription
let package = Package(
name: "HelloWorld",
dependencies: [
.Package(url: "https://github.com/
vapor/vapor.git", majorVersion: 1)
]
)
29. Open in Xcode
$ swift package generate-xcodeproj
$ open HelloWorld.xcodeproj
33. Now…to deploy to the web!
$ git init
$ heroku create
$ heroku buildpacks:set https://
github.com/kylef/heroku-buildpack-swift
$ echo 'web: HelloWorld --
config:servers.default.port=$PORT' >>
Procfile
$ git add .
$ git commit -m "created project"
$ git push heroku master