Module Outline

Use the following resources and work with your mentor to master the objectives for this module. Practice by completing the Mini-Project, Project, and Challenges.

Stretch Problem

    Dispatch Groups

    1. Make a new PROJECT in xcode
    2. Make two methods, one called getNewPhotos(completion: () -> Void) and the other called uploadPhotos(completion: () -> Void)
    3. Both methods should get a random number between 0 and 10, print out the random number, and write NSThread.sleepForTimeInterval(YourRandomTimeHere)
    4. Make both methods completion blocks that complete when they are done
    5. In the viewDidLoad, call both methods and then (once both are done) print "All done!"
    6. Notice that they run one at a time and then finally print All Done!
    7. Try running both methods at the same time by adding dispatch_async to both of the methods (see GCD stretch problem
    8. What issues arise?

    Once finished, we'll go over a solution together.

  • Hint
  • Solution

Project

  • Unit 3 Assessment

    This assessment is designed to help you practice using what you learned in this Unit. To complete it you will need to be familiar with closures and asynchronous calls, NSURLSession, failable initializers, parsing through the returned data from network APIs, and working with network API documentation.

Mastery Review

Module 20 - Flex - Swifty Swift
  • Expand all
  • Collapse all
  • Dispatch Groups stretch problem