© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
W. WangPro iPhone Development with SwiftUIhttps://doi.org/10.1007/978-1-4842-7827-7_3

3. Understanding Closures

Wallace Wang1  
(1)
San Diego, CA, USA
 

Reading a single sentence isn’t difficult for most people, but when you combine thousands of sentences together, reading a long mass of text can be cumbersome. That’s why people divide large amounts of text into parts such as paragraphs and chapters. Programming is no different.

Rather than write code as one large mass of text, programmers typically divide a large program into smaller functions where each function performs a single task. Not only do functions help make a large program easier to understand, but ...

Get Pro iPhone Development with SwiftUI: Design and Manage Top Quality Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.