Cover....1
Halftitle....2
Title....4
Copyright....5
Dedication....6
Contents....8
Preface....14
Acknowledgments....18
About the Author....20
Chapter 1: Full-Stack Development Overview....22
Introduction....22
Structure....22
Introduction to Full-Stack Development....23
Brief History....25
Full-Stack: What Does It Mean?....26
Minimum Viable Product (MVP)....26
Airbnb....27
Foursquare....27
Problems with Full-Stack Development....28
Advantages of Full-Stack Development....31
Swift on Server and Vapor....32
Swift Packages for Back-End Development....35
SwiftNIO....35
AsyncHTTPClient....36
Swift AWS Lambda Runtime....37
Soto—AWS SDK Swift....37
Conclusion....38
Chapter 2: Setting Up the Environment....40
Introduction....40
Structure....40
Installation of Xcode....41
Installation of the Vapor Toolbox....42
Hello World Project (Vapor)....43
Build and Run Project....43
Folder Structure....45
Public Folder....46
Sources....46
Run....46
Tests....47
Swift Package Manager....47
Hello World Project (iOS)....48
Project Structure....52
Add Hello World Label....53
Run Xcode Project....56
Conclusion....60
Chapter 3: Routing, MVC, and JSON in Vapor....62
Introduction....62
Structure....62
Objectives....63
Routes....63
Router Methods....64
Basic Routes....64
Nested Routes....65
Route Parameters....68
Anything Routes and Catch-All Routes....71
Query Strings....73
Route Groups....74
Model-View-Controller (MVC)....76
Working with JSON....84
Posting JSON and Postman App....88
Conclusion....94
Chapter 4: Async and HTML Rendering in Vapor....96
Introduction....96
Structure....96
Objectives....96
Async....97
Async Await....97
Migrating to Async/Await....97
Logging....98
Environment....100
Errors....101
Abort....101
Abort Error....102
Debuggable Error....104
Stack Traces....106
Swift Backtrace....106
Error Traces....106
ErrorMiddleware....107
Leaf....108
Conclusion....115
Chapter 5: PostgreSQL Integration in Vapor....116
Introduction....116
Structure....116
Objectives....117
Data Persistence with Vapor....117
Installing and Setting Up PostgreSQL....117
Fluent ORM....125
Adding Fluent to a New Project....125
Adding Fluent to an Existing Project....128
CRUD Operations....128
Migrations....131
Postico....133
Create and Save Model....137
Create Model....137
Save Model....137
Conclusion....142
Chapter 6: Building User Interfaces for iOS....144
Introduction....144
Structure....144
Auto Layout with Storyboards....145
Swift UI....156
Working with Text....158
Working with Images....161
Working with Stacks....165
Conclusion....169
Chapter 7: Data Persistence with Core Data and SQLite in iOS....170
Introduction....170
Structure....170
Core Data....171
Core Data Stack....171
Include Core Data in a New Project....172
Include Core Data in an Existing Project....173
CRUD Operations....175
Codegen....179
Category/Extension....180
Core Data Migrations....182
Lightweight Data Migration....183
Networking....185
Protocol Support....186
Conclusion....186
Chapter 8: Full-Stack Implementation....188
Introduction....188
Structure....188
Objectives....189
Project Outline....189
Setup Remote Database....189
Server App....192
Models....193
Migrations....196
Controllers....198
Config and Routes....201
iOS App....205
Models....206
Networking....208
User Interface....213
Test Run....222
Conclusion....224
Chapter 9: Advanced Full-Stack Concepts....226
Introduction....226
Structure....226
Objectives....226
Middleware....227
Creating Middleware....228
WebSockets....230
Messages....230
Sending....231
Receiving....231
Closing....232
APNS....232
Security....237
Authentication....237
Basic Authentication....238
Bearer Authentication....240
Composition....241
Session....243
JWT....245
KeyChain....247
Adding a Password to Keychain....248
Conclusion....250
Chapter 10: Deploying iOS and Vapor Applications....252
Introduction....252
Structure....252
Objectives....253
Vapor App Deployment....253
Heroku....253
Docker....257
Set up Docker....258
Build and Run....260
Production Deployment....260
iOS App Deployment....261
Code Signing....261
Create App Store Connect Record for the App....262
Add New App....263
Archive and Upload the App....263
Configure the App’s Metadata in App Store Connect....265
Submit App for Review....266
Conclusion....268
Index....270
This comprehensive book combines the strengths of Swift, the Vapor framework, and iOS development to create dynamic, full-stack applications. Perfect for aspiring developers, students, and seasoned iOS professionals, this book equips you with the skills needed to master both server-side and client-side development. Key topics include understanding the fundamentals and history of full-stack development and the concept of a minimum viable product; installing and configuring essential tools and SDKs for Vapor and iOS development; mastering data persistence by integrating PostgreSQL with the Vapor framework; and implementing data storage solutions in iOS apps using Core Data and SQLite. Companion files (sample code and figures) are available for downloading by writing to the publisher.