Join Scott Gardner for an in-depth discussion in this video Create recursive enumerations, part of Swift 3 Essential Training: Beyond the Basics.
- [Instructor] An enumeration can associate…an instance of itself to one or more cases.…These are referred to as recursive enumerations.…I'm starting out with an empty…employee enumeration definition.…Let's say I'm developing an org chart out,…and I want to display each employee's name and title…followed by their manager's name and title,…that manager's manager's name and title,…and so on, all the way to the top.…I'll define a case that associates name and title strings…and a manager of type employee.…
I'm getting an error.…Recursive "enum" employee is not marked indirect,…along with a Fix-It to mark it as indirect.…I'll accept that Fix-It.…An individual case can also be marked as recursive…with the indirect keyword before the case clause.…In the event that just a single member needs…to be recursive and not the whole enumeration,…I'll move the indirect mark to the sum case.…When the compiler encounters an indirect keyword…it has to insert a layer of indirection…to enable recursion.…
According to Apple documentation,…
- 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.