Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Hands-On Server-Side Web Development with Swift
Hands-On Server-Side Web Development with Swift

Hands-On Server-Side Web Development with Swift: Build dynamic web apps by leveraging two popular Swift web frameworks: Vapor 3.0 and Kitura 2.5

eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Hands-On Server-Side Web Development with Swift

Getting Started with Vapor and Kitura

This chapter aims at getting you started with both Vapor and Kitura. You'll be introduced to Vapor Toolbox, a command-line interface (CLI), which allows you to rapidly develop Vapor apps from several boilerplate Vapor projects. You'll follow a step-by-step guideline to install Vapor Toolbox on macOS or Linux, and then check your system's readiness by using Vapor CLI tools to verify system compatibility with the required development environment. Similarly, you'll get introduced to the Kitura development environment and follow step-by-step instructions to install Kitura tools and libraries on your system.

In this chapter, we'll cover the following topics:

  • Installing Vapor and Kitura on macOS
  • Installing Vapor and Kitura on Ubuntu
  • Exploring Vapor Toolbox and the Kitura CLI
...

Installing Vapor and Kitura on Mac

Even though you can start server-side Swift development on either macOS or Linux, you'll find it more convenient to develop server-side Swift projects on macOS with Apple's free Integrated Development Environment (IDE) tool, Xcode. Xcode has integrated many powerful editing and debugging features to streamline the workflow for code development with Swift; for example, syntax highlight, auto completion, refactoring, and code coverage for unit tests.

Follow the steps in the following sections to prepare your Mac for server-side Swift development with both Vapor 3.0 and Kitura 2.5. Skip the installation steps for macOS and go directly to the next section if you want to use the Linux environment instead.

Preparing your Mac for server-side Swift...

Installing Vapor and Kitura on Ubuntu

This section is for installing Vapor and Kitura on Ubuntu. Skip this section if you intend to develop on your Mac only.

Working with the Ubuntu APT

You're going to work with the Advanced Packaging Tool (APT) library to perform installation of Vapor and Kitura. APT is a package manager for Debian-based Linux operating systems such as Ubuntu. The package manager keeps a list of packages that it can install in repository or cache and sorts out the dependencies required for the software packages. Run the following at Command Prompt:

$ sudo apt-get install <package>

The apt-get install command checks for the repository for the package specified as <package>. If the package...

Exploring Vapor Toolbox and the Kitura CLI

Vapor Toolbox and the Kitura CLI are provided to make your life easy with extensive command-line tools and to accelerate your server-side Swift project development effort with many useful boilerplate projects. Since Vapor and Kitura projects are built with Swift Toolchains, you also have access to an array of tools in Swift Package Manager (SPM), the standard software package manager for managing the distribution of Swift projects.

SPM includes the following handy commands:

Useful CLI Commands Usage
swift build Compiles the package in the current directory
swift run Runs the executable in this package (for only one executable in the package)
swift run Runs the executable in this package
swift package resolve Resolves the dependencies and download missing packages
swift package xcode-generateproj Creates an Xcode project...

Exploring the Kitura CLI

Most of the CLI features in Kitura are encompassed in Kitura Application Generator (KAG), which allows you to configure a new Kitura project in a question and answer way. If you just need a basic starter project, you can simply use the kitura init command:

Useful CLI Commands Usage
kitura init Creates a basic starter project
kitura create Creates an application using KAG

The rest of this section will cover the usage of KAG.

Using KAG

The kitura create command will launch Kitura's powerful application generator. If you don't want to customize the boilerplate for your Kitura project, you can simply skip this tool and use kitura init to create a basic starter project.

Once you...

Summary

In this chapter, you've been provided with step-by-step instructions on how to install both Vapor Toolbox and the Kitura CLI on Mac or Linux. Whether Mac or Linux, your system is now ready for some serious server-side Swift project development. You've also learned the usage of some of the most useful command-line tools offered by the Swift Package Manager, Vapor Toolbox, and the Kitura CLI. In the next chapter, you're going to explore these tools to develop your first web applications using the Vapor and Kitura frameworks.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Build a full-stack iOS and web applications using Swift, Vapor, and Kitura Framework
  • Leverage ORM abstraction drivers to make queries to SQL database
  • Develop your very own containerized microservices with Swift, Docker and Kubernetes

Description

This book is about building professional web applications and web services using Swift 4.0 and leveraging two popular Swift web frameworks: Vapor 3.0 and Kitura 2.5. In the first part of this book, we’ll focus on the creation of basic web applications from Vapor and Kitura boilerplate projects. As the web apps start out simple, more useful techniques, such as unit test development, debugging, logging, and the build and release process, will be introduced to readers. In the second part, we’ll learn different aspects of web application development with server-side Swift, including setting up routes and controllers to process custom client requests, working with template engines such as Leaf and Stencil to create dynamic web content, beautifying the content with Bootstrap, managing user access with authentication framework, and leveraging the Object Relational Mapping (ORM) abstraction layer (Vapor’s Fluent and Kitura’s Kuery) to perform database operations. Finally, in the third part, we’ll develop web services in Swift and build our API Gateway, microservices and database backend in a three-tier architecture design. Readers will learn how to design RESTful APIs, work with asynchronous processes, and leverage container technology such as Docker in deploying microservices to cloud hosting services such as Vapor Cloud and IBM Cloud.

Who is this book for?

This book is about building professional web applications and web services using Swift and leveraging two popular Swift web frameworks: Vapor 3.0 and Kitura 2.5. We assume the readers to have some working knowledge of Swift programming language. The readers could be beginners of Swift programming, seasonal iOS or macOS developers, or software developers who want to work on practical Swift applications while learning the language itself. By the end of the book, you would be able to successfully create your own web applications and web services by leveraging the powerful ecosystem of Swift.

What you will learn

  • Build simple web apps using Vapor 3.0 and Kitura 2.5
  • Test, debug, build, and release server-side Swift applications
  • Design routes and controllers for custom client requests
  • Work with server-side template engines
  • Deploy web apps to a host in the cloud
  • Enhance web content with Bootstrap
  • Manage user access using authentication framework
  • Design for API gateway
  • Develop an iPhone app to work with web services
  • Deploy your app as a microservice in a cluster
  • Deploy Swift web services with a RESTful API design

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 30, 2018
Length: 404 pages
Edition : 1st
Language : English
ISBN-13 : 9781789345865
Vendor :
Apple
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Nov 30, 2018
Length: 404 pages
Edition : 1st
Language : English
ISBN-13 : 9781789345865
Vendor :
Apple
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 115.97
Mastering iOS 12 Programming
€41.99
Hands-On Server-Side Web Development with Swift
€36.99
Hands-On Design Patterns with Swift
€36.99
Total 115.97 Stars icon
Banner background image

Table of Contents

17 Chapters
Introducing Server-Side Swift Chevron down icon Chevron up icon
Getting Started with Vapor and Kitura Chevron down icon Chevron up icon
Building Your First Web App Chevron down icon Chevron up icon
Debugging and Testing Chevron down icon Chevron up icon
Setting Up Routes and Controllers Chevron down icon Chevron up icon
Working with Template Engines Chevron down icon Chevron up icon
Bootstrapping Your Design Chevron down icon Chevron up icon
Employing Storage Framework Chevron down icon Chevron up icon
Adding Authentication Chevron down icon Chevron up icon
Understanding Technologies for Web Services Chevron down icon Chevron up icon
Designing for API Gateway Chevron down icon Chevron up icon
Deploying to the Cloud Chevron down icon Chevron up icon
Developing an iPhone Client Chevron down icon Chevron up icon
Developing Microservices Chevron down icon Chevron up icon
Vapor Boilerplate Project Chevron down icon Chevron up icon
Kitura Boilerplate Project Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.