Join Harrison Ferrone for an in-depth discussion in this video Extensions and protocols, part of Learning Swift 3 for Developers.
- [Narrator] I'm going to close out of chapter seven,…and create file new playground.…Going to name this chapter eight underscore advanced topics.…Hit next.…Save it into my Swift3 for Developers folder on my desktop,…and hit create.…One last time let's delete the default string,…and the comment, and add some of our own.…Going to say chapter eight advanced topics.…
Here for our video title extensions and protocols.…Any Swift type can be extended to fit your needs.…This is especially powerful when it comes to adding custom…functionality to existing classes and even to your own.…Let's extend the string class…as a simple example of how this works.…I'm going to use the extension keyword,…and string, open and closed curly brackets.…And that's it.…Inside the extension, let's add a function called add debug.…
It's not going to take in any parameters,…but it is going to return a string.…Here we're just going to return debug log,…and in our interpolated syntax self,…and self here, since we're extending the string class,…
- 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.