Copyright ©2023 by AppCoda Limited
All right reserved. No part of this book may be used or reproduced, stored or transmitted in any manner whatsoever without written permission from the publisher.
Published by AppCoda Limited
What People Say About This Book
"This book got me an internship and a job. After one week of following this book’s tutorial, I was immediately able to begin developing my own app! 4 months later, I got an offer at Ancestry to intern as an iOS developer. Best money I ever spent!!"
- Adriana, iOS developer at Ancestry
"The Basic and Intermediate books are everything you need to understand all the concepts of design, coding, testing, and publishing an app. All you need is the idea."
- Rich Gabrielli
"I have published 8Cafe and 8Books, apps based on, and inspired by, the AppCoda Swift iOS book; it was a pleasure to learn and develop with your team. In fact, a lot of my apps/games utilise ideas and techniques from your excellent Beginner and Intermediate Swift books. To me, and a lot of developers, your talent, knowledge, expertise and willingness to share have been simply a godsend."
- Mazen Kilani, creator of 8Cafe
"I've been developing iOS apps for about a year now and am greatly indebted to the team at AppCoda. The Swift books I've purchased from them have dramatically increased my productivity and understanding of the entire Xcode and iOS development process. I've learned much more than I ever would have by scouring StackOverflow and github for hours and hours, which is what I had been doing prior to deciding to use AppCoda. All of the information is updated and accurate, simple to read and follow, and the sample projects are fantastic. I really can't recommend these books highly enough. If you're trying to jump-start your Swift education, go for it."
- David Gagne, creator of Bartender.live
"AppCoda's books are fantastic. They are clearly written, assuming no knowledge, but still push you to think for yourself and internalize the concepts. No other resource is so comprehensive."
- JP Sheehan, Ingot LLC
"The book is well written, concise, with excellent example code and real-world examples. It's really helped me get my first App on the App store, and given me many ideas for further enhancements and updates. I also use it as a reference guide ongoing as well with the language, and the updates produced as Swift and iOS change are much gratefully received."
- David Greenfield, creator of ThreadABead
"Thanks for making such an awesome book! This book helped me develop my first real app and have made $200 on the app store in less than 2 months since launch. I was also able to get a software developer job where now I am running the Mobile department. Thanks again for the great book, I always try to promote it when people ask me about learning how to code."
- Rody Davis, Developer of Pitch Pipe with Pitch Assistant
"The book is really good. I was taking other courses of Swift from Udemy and the instructor did not have much background as a developer. In your case, I know you have a good background as a developer. By the way, you explain the things."
- Carlos Aguilar, creator of Roomhints Interior Design Ideas
"For years, I'd been looking in vain for good quality resources to help sharpen my app development skills. Your books saved my life. They're the best explained programming books I've ever read in my 10 years of programming. They're so easy to understand and they hit everything. I will never thank you enough for writing the books and I owe you a lot."
- Eric Mwangi
"This book is clearly written with lots of examples. It is also great for experienced programmers new to Swift."
- Howard Smith, Flickitt
"Without this book, I couldn't become an iOS developer."
- Changho Lee, SY Energy
"I wanted to learn about iOS programming with Swift. For this, I turned to this book. It's an absolutely great way to learn Swift and iOS app development. If you have some programming background, you'll be able to do real stuff within a couple of days. But even if you do not, you'll still be able to learn to develop apps."
- Leon Pillich
"This book is the best book I have found on the Internet. It is very straightforward. I started my programming journey three years ago and currently, all my app achievement was due to this book."
- Aziz, Engineer at Kuwait Concepts
"Insightful, helpful, and motivational. The books are full of knowledge and depth of the subject, providing hints and tips on many aspects of iOS development, and encourages the student/reader to push forward and to not be afraid of seeking a deeper understanding of the concepts. Just awesome."
- Moin Ahmad, Creator of Guess Animals
"This book taught me how to build the structure for the type of app I wanted to create. The lessons are well laid out, each one is just the right length to avoid overload. I would highly recommend this book as an excellent introduction to creating your first app and beyond."
- Stephen Donnelly, Director at Rascalbiscuit
"I tried multiple learning sources including the Stanford training. Although I already did learn some topics like auto layout, delegates, segues, etc through other sources, your book was the first one that really made me understand them!"
- Nico van der Linden, SAP developer at Expertum
"Over the past three years, I have purchased more than a dozen books on Objective C and Swift. As a high school AP computer science teacher I work mainly with Java but I also teach several other programming languages so I tend to keep a large library of books on-hand. While many of the other books and online video tutorials I purchased these past years were very good, I found AppCoda's to be far above all others. Simon has a way of presenting a topic in such a manner where I felt he was teaching me in a classroom environment rather than just me reading words on a screen. The best way to describe his writing style is to say it feels like he is speaking to you, not just giving you instructions."
- Ricky Martin, Gulf Coast High School
"This was one of the easiest books I have found to learn Swift. As a beginner, it was extremely easy to follow and understand. The real-life examples you include as your work through the book and build the app being taught is genius and makes it all worth it in the end. I was able to take many things away and apply to my own apps. I find myself referring back to it many times. Great Work."
- Bill Harned, creator of Percent Off
"Best books on iOS development, well designed and easy to follow, and a great development journey companion."
- Ali Akkawi, freelancer in mobile apps development for iOS and Android
"I like the book. The contents are well structured. We have almost all of the latest concepts covered."
- Barath V, Lead iOS developer at Robert Bosch LLC
"I have purchased both the Beginning and Intermediate iOS 11 Programming with Swift books. I am a Java developer turned iOS mobile developer and these books really helped me learn the concepts of building a mobile application. The FoodPin application that you build in the Beginner book is an excellent way to learn all of the most common components of a mobile app. Even though I have now been working on iOS apps for over three years, I still regularly go back to the AppCoda swift books as a reference."
- Stacy Chang
"I probably could have done it without the book but it would've taken WAY longer and I probably wouldn't have understood what I was doing so well. If it weren't for this book my app probably won't be in the App Store right now. True story. Keep it up!"
- Marc Estwick
Preface
A couple years ago, people still asked, "Is Swift ready for app development?"
Now everyone knows Swift is the programming language to learn for developing iOS apps.
I have a genuine passion for Swift programming, and my admiration for this language is not solely driven by my profession as a Swift programming instructor or a desire to promote my courses/books. With over 15 years of programming experience in various languages, I can confidently say that Swift has become my favorite language at present. Its well-designed structure, simplified syntax, and cleanliness are some of the key factors that contribute to its appeal. Swift's ease of learning and enhanced productivity in iOS app development make it a standout choice compared to the more traditional Objective-C.
Introduced by Apple in June 2014, Swift has undergone significant updates and advancements. Fast forward to today, the company already released version 5.9 of the programming language along with Xcode 15, introducing a wealth of features. With over 9 years of development since its first release, Swift has transcended its status as a new language. It has matured into a robust and well-established programming language, poised to tackle application development across iOS, macOS, watchOS, and tvOS. Notably, renowned companies such as Lyft, LinkedIn, and Mozilla have embraced Swift for their app development endeavors. Whether you aspire to create your next iOS app or forge a career in iOS app development, Swift undoubtedly stands out as the programming language to learn and employ.
This book covers everything you need to learn for iOS app development. However, it's important to remember that Swift is merely a programming language. To successfully develop an iOS app, you'll need to acquire knowledge beyond Swift alone. In addition to introducing Swift, this book will guide you through the process of designing user interfaces using SwiftUI and mastering the essential APIs of the iOS SDK. Most importantly, you'll gain practical Swift programming skills by building a real-world app from the ground up.
For those starting from scratch without any programming experience, you may wonder if it's possible to learn Swift programming and create a functioning iOS app.
Having personally programmed in Swift since its inception, I can confidently state that Swift is incredibly accessible and much easier for beginners to grasp compared to Objective-C. While not everyone may become an exceptional developer, I firmly believe that anyone can learn programming and develop an app using Swift. All it requires is dedication, perseverance, and a proactive approach to learning and taking action. With the right mindset and effort, you can embark on a rewarding journey of Swift programming and app development.
I launched AppCoda about 10 years ago and started to publish iOS programming tutorials on a weekly basis. Since then, I have published several books on iOS app development. At first, I thought people, who want to learn app development, are those with programming experience and technical background. What's interesting is that people from diverse backgrounds are passionate to build their own apps. I have a reader from France, who is a surgeon by profession, started from zero programming experience to launching his first app, which allows anyone to share and advertise event information for free. Another reader is a pilot by profession. He began to learn iOS programming a couple years ago and is now building iPhone apps for his own use and other pilots. Boozy is an app for finding Happy Hours, Daily Deals and Brunches. It was built by a law school dropout. The creator of the app could not find a good place for a drink in DC area. So she decided to make an app to meet a real need. Similarly, she did not know coding when she came up with the idea. She just got started and learned along the way.
From time to time, I got emails from individuals expressing their desire to create an app. These messages often contain similar sentiments: "I have an app idea, but I don't know where to start. I lack programming skills. Can I learn from scratch and bring my idea to life?"
What I learned from these truly inspiring stories is that you do not necessarily require a Computer Science or Engineering degree to develop an app. These readers share a common attribute: unwavering commitment to taking action. They all invested their hard work to transform their aspirations into reality. And that is precisely what you need.
So, you have an app idea? I wholeheartedly believe that you have the ability to bring it to life. There is absolutely nothing that can hold you back from learning and accomplishing your goals if you possess true passion and dedication. Let me borrow one of my favorite quotes from Last Lecture to conclude:
Brick walls are there for a reason: they let us prove how badly we want things.
- Randy Pausch
Lastly, thanks for picking up the book. I hope you will enjoy reading it and that it helps you in launching your first iOS app on the App Store. If you would like to share the story of your app development journey, please don't hesitate to drop me an email at [email protected]. I would be thrilled to hear from you and learn about your experiences.
Simon Ng
Founder of AppCoda
What You Will Learn in This Book
This new book is specifically designed for readers who have an app idea but are unsure of where to begin. It comprehensively covers Swift programming, guiding you through the process of building a real-world app from scratch. Starting with the basics of Swift and SwiftUI, you'll progress to prototyping and constructing the app step by step.
Each chapter focuses on utilizing iOS APIs to implement different features. By the end of the book, you'll have a fully functional app. Throughout the journey, you'll learn essential skills such as data presentation in list views, UI design using Stack Views, creating animations, working with maps, developing adaptive UI, local database storage, iCloud data upload, TestFlight beta testing, and more.
This book offers numerous hands-on exercises and projects, allowing you to write code, debug, and test your app. While it requires effort, the experience will be rewarding. By the end, you'll have a solid grasp of Swift 5.9, Xcode 15, and iOS 17 programming. Most importantly, you'll have the ability to develop an app and release it on the App Store.
Audience
This book is tailored for individuals who are beginners in programming and have no prior experience. It is also suitable for programmers seeking to learn a new language, designers aiming to transform their designs into iOS apps, or entrepreneurs interested in acquiring coding skills.
Assuming you are already familiar with using macOS and iOS as a user, this book will provide you with the necessary knowledge to embark on your Swift programming journey.
SwiftUI vs UIKit
The introduction of SwiftUI had a tremendous impact on both existing iOS developers and those interested in learning iOS app development. It unquestionably represented the most significant change in recent years within the realm of iOS app development. However, this shift may lead beginners to feel confused about which UI framework to focus on. The question arises: which one should you learn or begin with?
To make a decision, it's essential to reflect on your motivation for learning iOS programming and determine your goals. Are you aiming to become a professional iOS developer and secure employment? Or are you simply interested in learning something new as a hobby?
If your aspiration is to pursue a career as a professional iOS developer and secure job opportunities, it is advisable to learn both frameworks. The majority of apps on the App Store are developed with UIKit. Therefore, it is highly likely that you will work on UIKit-based apps in a professional setting. In this case, starting with UIKit and subsequently transitioning to SwiftUI would be a suitable approach.
On the other hand, if you are taking up programming as a hobby or working on an app as a side project, I recommend diving straight into SwiftUI.
This book is available in two editions: UIKit and SwiftUI. Both editions guide you through building the same real-world app but using different UI frameworks. If your intention is to start with SwiftUI, you can continue reading from Chapter 1. Otherwise, opt for the UIKit edition of the book.