In Swift, functions are considered first-class citizens, which means that they can be treated the same as any other type. They can be assigned to variables and be passed in and out of other functions. When treated this way, we call them closures. This is an extremely critical piece to write more declarative code because it allows us to treat functionalities like objects. Instead of thinking of functions as a collection of code to be executed, we can start to think about them more like a recipe to get something done. Just like you can give just about any recipe to a chef to cook, you can create types and methods that take a closure to perform some customizable behavior.
Learning Swift Second Edition - Second Edition
By :
Learning Swift Second Edition - Second Edition
By:
Overview of this book
Swift is Apple’s new programming language and the future of iOS and OS X app development. It is a high-performance language that feels like a modern scripting language. On the surface, Swift is easy to jump into, but it has complex underpinnings that are critical to becoming proficient at turning an idea into reality.
This book is an approachable, step-by-step introduction into programming with Swift for everyone. It begins by giving you an overview of the key features through practical examples and progresses to more advanced topics that help differentiate the proficient developers from the mediocre ones. It covers important concepts such as Variables, Optionals, Closures, Generics, and Memory Management. Mixed in with those concepts, it also helps you learn the art of programming such as maintainability, useful design patterns, and resources to further your knowledge. This all culminates in writing a basic iOS app that will get you well on your way to turning your own app ideas into reality.
Table of Contents (19 chapters)
Learning Swift Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Free Chapter
Introducing Swift
Building Blocks – Variables, Collections, and Flow Control
One Piece at a Time – Types, Scopes, and Projects
To Be or Not To Be – Optionals
A Modern Paradigm – Closures and Functional Programming
Make Swift Work For You – Protocols and Generics
Everything Is Connected – Memory Management
Paths Less Traveled – Error Handling
Writing Code the Swift Way – Design Patterns and Techniques
Harnessing the Past – Understanding and Translating Objective-C
A Whole New World – Developing an App
What's Next? – Resources, Advice, and the Next Steps
Index
Customer Reviews