Join Scott Gardner for an in-depth discussion in this video Nest function types, part of Swift 3 Essential Training: Beyond the Basics.
- [Narrator] Function types can also nest function types,…and this provides a way to perform currying in Swift.…Currying is a programming technique…that can be used to replace a multi-parameter function…with a single-parameter curried function.…The curried function can hold onto…the original parameter values…across multiple culls to it.…In Swift 3, currying syntax was removed…as indicated by the error here.…This is an example from my…Swift 2 Essential Training course.…I'm going to refactor it using a nested function…in order to make it work again in Swift 3.…
What this function did previously…is take product and price parameters…and return a function that takes a quantity parameter…and returns a string representing a line item…for a product at a discounted price…based on the quantity specified.…The first thing I'll do is remove the currying syntax…by writing an arrow to indicate…that the function returns a function type…that takes an int and returns a string.…As the error now indicates, function types…cannot have an argument label,…
- Adding source files, resources, links, and literals
- Adding pages to a playground
- Using overflow operators and bitwise operators
- Using ranges with strings
- Creating complex sequences
- Chaining higher-order functions
- Defining lazy properties
- Using failable initializers
- Mutating methods
- Working with singletons
- Nesting function types
- Creating error types and recursive enumerations
- Extending concrete types
- Referencing selectors and key paths
- Working with protocol-oriented programming
- Defining class-only protocols and optional protocols
- Using option sets, type checking, and casting operators
Skill Level Intermediate
Core Data for iOS and macOS Enterprise Developerswith Jon Bott1h 46m Intermediate
Distributing Your iOS App for Testing with TestFlightwith Ron Buencamino35m 10s Intermediate
iOS App Development: Test-Driven Developmentwith Harrison Ferrone2h 14m Intermediate
3. Strings and Characters
4. Sequences and Collections
5. Control Flow
6. Value and Reference Types
9. Access Control
Understand access control3m 47s
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.