简体中文 | English
"Perhaps you couldn't imagine, this book on SwiftUI programming was written by a product manager.
Four years ago, by a stroke of luck, I started to delve into iOS programming. Due to the company's lack of iOS developers at the time, I volunteered to assist in completing some basic functionalities of the company's iOS version application alongside my primary product responsibilities.
Back then, despite having learned programming languages like C# and C++ during my college years, and having no experience using any programming language in my professional life, I remained optimistic. With the consent of the CTO, I obtained a programming book and embarked on the journey of trial and error.
At that time, using Swift + UIKit for programming, various protocols and layout constraints made me feel overwhelmed. Each time I implemented a small feature or page, it almost took me an entire night. However, as I gradually became familiar with its syntax, I was able to implement some basic functionalities and engage in in-depth discussions with other developers on certain technical issues. This was an unexpected gain.
To be honest, from installing the official development tools and writing the first "Hello, World!" to running and testing the first pre-release version of the app in the simulator, I was both clueless and excited. The moment the project ran on the simulator, I felt I had surpassed the limits of a product manager and become a "tech-savvy" product manager.
Later, due to my strong interest in iOS programming, I began to explore Swift + SwiftUI.
SwiftUI is a new framework released by Apple at the 2019 WWDC Worldwide Developers Conference. It is rarely used in commercial product development in China, and there are very few relevant development books available domestically. Therefore, I spent a long time learning it, and as a result, lost quite a bit of hair.
For the sake of convenient learning and review in the future, I started publishing columns on SwiftUI in the Juejin technology community to record the learning process. After about half a year and updating about 150 articles in 5 columns on the platform, I was fortunate enough to become a contracted author with the Juejin technology community. Later, I was invited by the China Water Conservancy and Hydropower Press editor to write and publish this book.
And that's how this book came to be.
Before preparing to write this book, I was thinking about how to make it vivid and interesting.
Although the target readers of this book are more iOS developers, computer science graduates, or other practitioners who want to learn iOS programming, I hope this book can be suitable for everyone, not just programmers.
Everyone should learn programming, and everyone can learn how to think independently and analyze and solve problems through programming.
I don't want this to be a dull book, nor do I want you to follow the content of the book and still be unable to independently develop an ideal app by the end.
When I was just starting to learn, I found many free or paid books and tutorials at home and abroad. I followed the code line by line in the project cases, but in the end, I only implemented the content in the cases and could not develop a complete app.
This is a big blow to someone who wants to achieve their ideals and ambitions through hard work.
It's not because I'm not working hard enough, or because I'm not smart enough, but because these books and materials can only teach you so much, which is a very sad thing.
My ideal book is one that enables us to develop an app that can be launched on the App Store step by step according to the book. When we encounter problems in programming, we can quickly find solutions in the corresponding sections of the book. When we finish learning the last chapter or halfway through, we can develop the app we want, not just complete the examples in the book... Of course, the knowledge points in the book should be the latest.
Therefore, this book will include basic knowledge as well as some practical examples. We will implement very small and exquisite pages and explain how to use SwiftUI, a reactive UI framework, to build our ideal country, by analyzing complex concepts in programming.
SwiftUI is an open-source cross-platform UI framework launched by Apple, which supports iOS, MacOS, WatchOS, TvOS, and other platforms. With this framework, complex interactions and functions can be implemented with very little code, greatly improving development efficiency.
This book consists of 29 chapters, systematically explaining SwiftUI background, Swift language syntax basics, SwiftUI basic components, interactive operations, data storage, network requests, hardware devices, payment models, app launching, and other contents. Each chapter is explained in conjunction with vivid and interesting examples, enhancing the fun of the book.
Through studying this book, readers will have a comprehensive understanding of the SwiftUI framework and multi-platform development and will be able to independently develop using SwiftUI. This book is suitable for developers who are learning Swift + SwiftUI and those interested in SwiftUI to read and reference.
As this is the first time I have published a book, my writing skills may be a bit immature, so there may be some errors or unclear parts in the book. While asking for your understanding, I also welcome corrections and feedback. All the examples in the book can be downloaded from GitHub (https://github.com/RicardoWesleyli/SwiftUI.git). If you have any valuable ideas and suggestions, you can also directly send an email to 16620164429@163.com. Looking forward to meeting you.
Thanks to Miss Jiang Peiqi, who has always supported me. Your Mr. Li Zhiwei has finished writing this book~
Thanks to Mr. Wang Xinyu, the editor of the Water Conservancy and Hydropower Press, for the encouragement and help he gave me during the writing process, which enabled me to complete all the manuscripts smoothly.
Finally, thanks to my parents, Qi Qi's parents, and my sister who is about to enter the workplace, as well as Mr. Zhang Yong, Mr. Ye Yongcheng, and Mr. Xu Zhi, who have guided me on the road of life. Thank you for your support and help, lighting up the future path for me.
I dedicate this book to my dearest family and many friends who love iOS!"