API Template

Documentation Team Chat MIT License Continuous Integration Swift 4.1 Swift 4.1

Introduction


To built your web-application with Swift you need to first install its framework.
There are some Swift frameworks available

1: Vapor

2: Perfect

3: Kitura

Deployed APIS

Master branch of this repo is deployed on Heroko. You can test the deployed apis by reading the Documentation .

Vapor


But this repo used Swift with Vapor.
To use vapor you need to have Vapor installed on your machine & Xcode should be installed too.



Install Vapor



To install Vapor use bellow commands.



brew tap vapor/tap
brew install vapor/tap/vapor

Create New Project

Now go to your desired directory where you want to create a new Project. And paste the following command.

Vapor Project

vapor new YourProjectName

Once that finishes, change into the newly created directory.

cd YourProjectName

Generate Xcode Project

Let's now use the Vapor Toolbox's Ccode command to generate an Xcode project. This will allow us to build and run our app from inside of Xcode, just like an iOS app.

vapor xcode

Create Database.

For creating database with PostgreSQL Download and then below steps.

1: Download
2: Install
3: Initialze

After initialzing double click default database and it will open terminal just paste below lines and your database will be created.

CREATE DATABASE YourDatabaseName;

Now in your configure.swift file replace username with your selected database name on which you have double clicked and database name with YourDatabaseName.

Build

To build either you can use command or Xcode’s Play button at the top left. (But you need to choose Run from your provided targets.

Contributions

Primary contributors for this repository are following. But we thanks to all of those who read/fork/raise an issue on this repo, because without there contribution we won't be able to stabalise it.

 Syed Qamar Abbas

 Umair Sharif

Click Here