Join Harrison Ferrone for an in-depth discussion in this video Explore dictionaries, part of Learning Swift 3 for Developers.
- [Narrator] Much like arrays dictionaries can…be declared a few different ways.…But by now, you should be recognizing the syntax,…and have hopefully found an inkling…of your Swift programming style.…I'm going to make some space underneath the array section,…and add a new comment.…Exploring dictionaries.…We're going to do the same thing we did with arrays…and declare empty dictionaries two different ways,…and a placeholder dictionary.…Let's start with var empty dict equals open bracket…and we need a type for our keys.…
Those are going to be integers,…and strings are going to be our value type,…and an open and closed parentheses.…We can also create an empty dict with an explicit type.…Var emptyAgain I'm going to call it, colon,…open bracket int and string equals…open bracket colon closed bracket.…Now for our placeholder, var placeholder dict colon…open bracket int for our keys and strings for our values.…
Lastly we can also have a dictionary that is type inferred.…Var type inferred dict equals, and we'll put key one colon,…
- 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?
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.