Conclusion

You’ve successfully completed Chapter 3, Intro to Functional Swift. In Lesson 1, you’ve learned how functions all can be expressed with closures. In fact, functions are also global closures. In Lesson 2, you’ve learned how to pass and return closure blocks indirectly and directly. In Lesson 3, you’ve learned how to initialize an object using a closure block and when to use a lazy property. In Lesson 4, you’ve discovered the unique behavior of closures, and found out that like classes, closures are reference types. Then, you’ve learned how to capture variables using Swift capture lists to prevent the unique behavior from occurring. Lastly, you’ve learned not only use use but create completion handlers blocks. It is a standard practice to use trailing closures to make the function looks cleaner. In the following chapter, you will finally get to learn about Swift protocols.