Skip to main content

Day 61

About 2 minSwiftcrashcoursepaul-hudsonswifthacking-with-swiftxcodeappstore

Day 61 ๊ด€๋ จ


100 Days of Swift - Day 61

Project 16, part two

Project 16, part two

I could easily have written this whole course about UIKit, skipping out Core Image, SpriteKit, MapKit, and more. But my hope is that by immersing you in other Apple frameworks youโ€™re starting to become soaked in their way of approaching things โ€“ youโ€™re starting to build a build a gut instinct for how Appleโ€™s framework work.

I realize this place extra learning stress on you, because rather than staying within our comfort weโ€™re constantly pushing forward into new things. It will help you in the long term, though โ€“ as James Bryant Conant said, โ€œbehold the turtle โ€“ it makes progress only when it sticks its neck out.โ€

Today youโ€™ve finished another app, and I hope feel like you have a basic grasp of how maps work. Thereโ€™s a lot more you can do with them, such as adding placemarksopen in new window, looking up locationsopen in new window, and finding directionsopen in new window, but I hope you can at least see that itโ€™s all within your grasp now!

Today you should work through the wrap up chapter for project 16, complete its review, then work through all three of its challenges.

Wrap up

Wrap up
100 Days of Swift - Day 61 - Wrap up

Wrap up

I tried to keep this project as simple as possible so that you can focus on the map component, because there was a lot to learn: MKMapView, MKAnnotation, MKPinAnnotationView, CLLocationCoordinate2D and so on, and all must be used before you get a finished product.

Again, we've only scratched the surface of what maps can do in iOS, but that just gives you more room to extend the app yourself!

Review what you learned

Anyone can sit through a tutorial, but it takes actual work to remember what was taught. Itโ€™s my job to make sure you take as much from these tutorials as possible, so Iโ€™ve prepared a short review to help you check your learning.

Click here to review what you learned in project 16.open in new window

Challenge

One of the best ways to learn is to write your own code as often as possible, so here are three ways you should try your new knowledge to make sure you fully understand whatโ€™s going on:

  1. Try typecasting the return value from dequeueReusableAnnotationView() so that it's an MKPinAnnotationView. Once thatโ€™s done, change the pinTintColor property to your favorite UIColor.
  2. Add a UIAlertController that lets users specify how they want to view the map. There's a mapType property that draws the maps in different ways. For example, .satellite gives a satellite view of the terrain.
  3. Modify the callout button so that pressing it shows a new view controller with a web view, taking users to the Wikipedia entry for that city.

Thatโ€™s another project finished, and one that gets you started with one of the most popular and powerful iOS frameworks โ€“ make sure you share your progress with others once you complete the challenges!


์ด์ฐฌํฌ (MarkiiimarK)
Never Stop Learning.