Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Weather App with Swift (Retired) Data Modeling With Structures Creating and accessing Swift Dictionaries

Help!

Retrieve the language used for iOS development by using the relevant key and dictionary subscripting notation and store it in a variable named iosLanguage.

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi umair,

If you remember back to the What is a Dictionary video in Swift Basics we can access key:value pairs within an dictionary by using the square brackets and an string which is the key.

For the task we can access the key iOS by setting that as the key and we get it's value by accessing the languages dictionary we set in task 1.

var iosLanguage = languages["iOS"]