5.12 Summary
This chapter was all about subroutines. You learned how to declare and call functions, which are executable and reusable code blocks. Functions can import and return parameters too, increasing their flexibility. It is also possible to overload the same function with multiple signatures and to create nested functions.
On the advanced side, you learned about standardizing functions as cookie-cutter templates using function types, making them interchangeable. Closures enable you to declare quick in-line functions, while generics allow you to flex Swift’s strict type system for function parameter types.
If you’re a beginner, you might not need those advanced features immediately. Many apps can be developed without them—but they surely ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access