Book Image

Hands-On Full-Stack Development with Swift

By : Ankur Patel
Book Image

Hands-On Full-Stack Development with Swift

By: Ankur Patel

Overview of this book

Making Swift an open-source language enabled it to share code between a native app and a server. Building a scalable and secure server backend opens up new possibilities, such as building an entire application written in one language—Swift. This book gives you a detailed walk-through of tasks such as developing a native shopping list app with Swift and creating a full-stack backend using Vapor (which serves as an API server for the mobile app). You'll also discover how to build a web server to support dynamic web pages in browsers, thereby creating a rich application experience. You’ll begin by planning and then building a native iOS app using Swift. Then, you'll get to grips with building web pages and creating web views of your native app using Vapor. To put things into perspective, you'll learn how to build an entire full-stack web application and an API server for your native mobile app, followed by learning how to deploy the app to the cloud, and add registration and authentication to it. Once you get acquainted with creating applications, you'll build a tvOS version of the shopping list app and explore how easy is it to create an app for a different platform with maximum code shareability. Towards the end, you’ll also learn how to create an entire app for different platforms in Swift, thus enhancing your productivity.
Table of Contents (19 chapters)
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
Index

Index

A

  • app
    • debugging / Debugging the app and server side by side
  • authentication flow
    • adding, to iOS application / Adding authentication flow to iOS app, Bringing it all together in the Storyboard
  • automated testing pipeline
    • about / Automated testing pipeline
    • Travis build check, enabling on Pull request / Enabling Travis build check on Pull request
  • Automatic Reference Counting (ARC) / Swift's evolution

B

  • BaseResourceController
    • creating / Creating a BaseResourceController
  • basic HTTP server
    • building / Building a basic HTTP server
  • BCrypt / Best practices for storing password

C

  • children / One to one (parent-child relation)
  • code
    • sharing, between iOS and tvOS app / Sharing code between iOS and tvOS
    • working, with iOS and tvOS app / Making code work with both iOS and tvOS apps
  • Continuous Deployment (CD)
    • setting up / Setting up Continuous Deployment
  • Continuous Integration (CI) / Automated testing pipeline
  • controllers
    • in Vapor / Controllers in Vapor
    • RESTful Controller / RESTful Controller
    • Shopping List controller / Shopping List controller
  • Controllers / Controllers
  • Create, Read, Update, and Delete (CRUD) / Counting items

D

  • data
    • fetching, from server / Fetching data from the server
  • database management system / Getting started with databases
  • databases
    • about / Getting started with databases
    • MongoDB / What is MongoDB?
  • Directives / Building a web server in Swift

E

  • Entity protocol / Vapor Models

F

  • flow of application
    • controlling, View Controller used / Controlling the flow of our application using View Controller
  • Fluent
    • about / What are ORM and Fluent?
    • in action / Fluent in action
    • item, creating / Creating an item
    • item, updating / Updating an item
    • item, obtaining / Getting all items
    • item, finding / Finding an item
    • item finding, filter used / Finding items using filter
    • item, deleting / Deleting an item
    • item, counting / Counting items
    • relations / Relations in Fluent
    • one to one / One to one (parent-child relation)
    • one to many / One to many
    • many to many / Many to many

G

  • Generics / Serving JSON and HTML formats

H

  • Heroku
    • deploying / Deploying to Heroku
    • app, priming for deployment / Priming the app for deployment
    • Vapor, configuring / Configuring and deploying Vapor to Heroku
    • Vapor, deploying / Configuring and deploying Vapor to Heroku
    • MongoDB Heroku addon, adding / Adding the MongoDB Heroku addon
  • Horizontal scaling / Where can we deploy a Vapor App?
  • HTML formats / Serving JSON and HTML formats
  • HTTP methods / HTTP methods
  • HTTP request / HTTP request and response
  • HTTP response / HTTP request and response

I

  • item
    • adding, to list / Adding items to the list
    • adding / Adding an Item
    • deleting / Deleting an Item
    • checking / Checking and unchecking an Item
    • unchecking / Checking and unchecking an Item

J

  • JavaScript
    • adding / Adding JavaScript
    • Shopping List, creating / Creating a new Shopping List
    • Shopping List, deleting / Deleting a Shopping List
    • item, adding / Adding an Item
    • item, deleting / Deleting an Item
    • item, checking / Checking and unchecking an Item
    • item, unchecking / Checking and unchecking an Item
  • JSON
    • serving / Serving JSON and HTML formats
  • Just-In-Time (JIT) / Swift's evolution

K

  • Kitura / Server-side web frameworks

L

  • Leaf / What is Leaf?
  • Leaf Provider
    • adding / Adding Leaf Provider
  • list
    • editing / Editing the list
  • List Cell / Configuring the tvOS storyboard
  • Low Level Virtual Machine (LLVM) / Swift's evolution

M

  • macOS / Building a web server in Swift
  • middleware
    • creating / Creating a middleware
  • mobile application
    • data, requesting / Mobile application requesting data
  • modern app development / Modern app development
  • mongo / Configuring Fluent config
  • Mongo config / Mongo config - mongo.json
  • MongoDB
    • about / What is MongoDB?
    • executing / How to install and run MongoDB
    • installing / How to install and run MongoDB
    • connecting / Connecting with MongoDB
    • Fluent config, configuring / Configuring Fluent config
  • mongodb services / Automated testing pipeline
  • MongoProvider
    • adding / Adding MongoProvider
  • multiple lists
    • about / Multiple lists
    • share code, refactoring / Refactoring to share code
    • Shopping List Model, blueprinting / Blueprinting the Shopping List Model
    • Shopping List Table View Controller / The Shopping List Table View Controller

N

  • network configuration / Network configuration
  • network requests
    • creating / Making network requests, Request helper

O

  • object-relational mapping (ORM) / What are ORM and Fluent?
  • operating system (OS) / Open source

P

  • parent / One to one (parent-child relation)
  • Perfect / Server-side web frameworks
  • Procfile / Configuring and deploying Vapor to Heroku
  • Providers
    • about / What are Providers?
    • building / Building your first Provider
    • exercise time / Exercise time
    • adding / Adding a Provider

R

  • relational databases / Getting started with databases
  • Representational State Transfer (REST) / Controllers
  • REST API
    • in action / REST API in action
    • Shopping List, creating / Creating the Shopping List
    • Shopping List, obtaining / Getting the Shopping List
    • Shopping List, updating / Updating the Shopping List
    • Shopping List, deleting / Deleting the Shopping List
    • items, creating / Creating items
  • RESTful routes
    • testing / Testing RESTful routes
    • Shopping List, fetching / Fetching all Shopping Lists
    • Shopping List, creating / Creating a Shopping List
    • Shopping List, deleting / Deleting the Shopping List
    • Shopping List, updating / Updating the Shopping List

S

  • segues / Bringing it all together in the Storyboard
  • server-side Swift
    • benefits / Benefits of server-side Swift
  • server-side web frameworks / Server-side web frameworks
  • servers
    • building, Vapor engine used / Building servers using Vapor's engine
  • server side
    • debugging / Debugging the app and server side by side
  • SHA-256 / Best practices for storing password
  • sharding / What is MongoDB?
  • share code
    • refactoring / Refactoring to share code
  • Shopping List
    • adding / Adding a Shopping List
    • deleting / Deleting a Shopping List, Deleting a Shopping List
    • example / Exercise
    • creating / Creating a new Shopping List
    • about / User has many Shopping Lists
  • Shopping List API
    • Vapor application / Shopping List API Vapor app
  • Shopping List app
    • features / Features of our Shopping List app
    • loading / Loading and auto-saving the Shopping List
    • auto-saving / Loading and auto-saving the Shopping List
    • on tvOS / Shopping List app on tvOS
  • Shopping List Item
    • adding / Adding a Shopping List Item
    • deleting / Deleting an item
    • checking / Checking and unchecking an item
    • unchecking / Checking and unchecking an item
  • Shopping List item model
    • blueprinting / Blueprinting the Shopping List Item model
    • example / Exercise, Exercise answer
  • Shopping List Model
    • blueprinting / Blueprinting the Shopping List Model
    • about / The Shopping List Model
  • Shopping List Table View Controller / The Shopping List Table View Controller
  • static file server
    • building / Building a static file server
  • structured query language / What are ORM and Fluent?
  • Swift
    • web server, building / Building a web server in Swift
  • Swift's evolution
    • about / Swift's evolution
    • open source / Open source
    • server-side Swift / Server-side Swift
  • Swift package manager
    • about / Getting started with Swift package manager
    • building / Building a Swift package
    • publishing / Publishing a Swift package
    • consuming / Consuming a Swift package
    • package's executable, installing / Installing the package's executable

T

  • Table View Controller / Controlling the flow of our application using View Controller, Table View Controller
  • token-based authentication
    • adding, for app / Adding token-based authentication for app
    • about / Adding token-based authentication for app
    • testing / Testing the token-based authentication
  • Travis build check
    • enabling, on Pull request / Enabling Travis build check on Pull request
  • Travis CI / Automated testing pipeline
  • tvOS storyboard
    • configuring / Configuring the tvOS storyboard

U

  • User model
    • creating / Creating a User model
    • password storing, best practices / Best practices for storing password
    • about / Getting started with the User model
  • user specific Shopping List
    • displaying / Showing user specific Shopping Lists

V

  • Vapor
    • about / Server-side web frameworks, Vapor, What is Vapor?
    • URL / Vapor
    • routing / Routing in Vapor
    • HTTP methods / HTTP methods
    • routers / Routers
    • nested routing / Nested routing
    • dynamic routing / Dynamic routing
    • wildcard routing / Wildcard routing
    • parameters, routing / Routing parameters
    • controllers in / Controllers in Vapor
  • Vapor application
    • building, from scratch / Building a Vapor application from scratch
    • view rendering / View rendering in Vapor app
    • Leaf / What is Leaf?
    • testing / Testing the Vapor application
    • test environment, setting up / Setting up the test environment
    • tests, executing / Running tests
    • deploying / Where can we deploy a Vapor App?
  • Vapor engine
    • used, for building servers / Building servers using Vapor's engine
    • basic HTTP server, building / Building a basic HTTP server
    • static file server, building / Building a static file server
    • WebSocket server, building / Building a WebSocket server
  • Vapor folder structure
    • about / Vapor folder structure
    • config / Vapor config
    • droplet / Vapor droplet
    • Views / Views
    • Controllers / Controllers
  • Vapor Model
    • about / Vapor Models
    • Shopping List Model / The Shopping List Model
    • Preparation protocol / Preparation protocol
    • JSONConvertible protocol / JSONConvertible protocol
    • ResponseRepresentable protocol / ResponseRepresentable protocol
    • Updateable protocol / Updateable protocol
    • Item Model / Item Model
  • Vapor toolbox
    • about / Vapor toolbox
    • installing / Installing the Vapor toolbox
    • commands / Vapor toolbox commands
    • used, for creating Vapor application / Creating a Vapor application using the toolbox
  • view
    • wiring up / Wiring up the view
  • View Controller
    • used, for controlling flow of application / Controlling the flow of our application using View Controller
    • about / Configuring the tvOS storyboard
  • Views / Views

W

  • web page
    • user requesting / User requesting a web page
    • registration, adding / Adding Registration and Login
    • login, adding / Adding Registration and Login
  • web server
    • working / How do the web servers work?
    • building, in Swift / Building a web server in Swift
  • WebSocket server
    • building / Building a WebSocket server

X

  • Xcode app
    • creating / Creating an app
  • Xcode Workspace / Xcode Workspace