Join Harrison Ferrone for an in-depth discussion in this video Introducing type aliasing, part of Learning Swift 3 for Developers.
- [Narrator] Type Aliasing is a great tool…for combining complex or unwieldy…custom values, into clear types.…We're going to look at how to create a type alias…for a tuple, and also for a closure.…We're going to make some room underneath…our closure section, and add…a header comment.…Introducing Type Aliasing.…Now I'm going to use the type alias keyword,…put in the type name as SimpleAlias,…and the type expression is going to be a tuple.…
Inside the tuple, we're going to have an integer,…a string, and a boolean.…From now on, when we use the SimpleAlias type,…it'll refer to our tuple of Int, String, and Bool.…We can also do the same thing with a closure.…Use typealias keyword again, we're going to…call this ClosureAlias,…and for the type expression, we're going to have…a string as an input, and the closure…is going to return void.…
Let's take these for a spin.…Define a new function with the return type of SimpleAlias.…Func ReturnSimpleAlias, no input parameters,…but it's going to return a type SimpleAlias.…Inside the function, we're just going to…
- Starting a new playground
- Printing to the console
- Declaring variables
- Working with numbers
- Using strings
- Breaking down optionals
- Understanding closures
- Classes vs. structs
- Extensions and protocols
Skill Level Beginner
1. Hello Swift
2. Back to Basics: Variables and Operators
3. Collections, Tuples, and Enumerations
4. Working with Logic Flows
5. Only in Swift: Optionals
6. Functions, Closures, and Associated Types
7. Classes vs. Structs
8. Advanced Topics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.