Skip to main content

Wrap up

About 1 minSwiftiOSArticle(s)bloghackingwithswift.comcrashcourseswiftxcodeappstoreios

Wrap up 관련

Hacking with iOS – learn to code iPhone and iPad apps with free Swift tutorials

Learn Swift coding for iOS with these free tutorials – learn Swift, iOS, and Xcode

Wrap up | Hacking with iOS

Wrap up

Multipeer connectivity is something that used to be awfully hard, but in iOS it's less than 150 lines of code to produce this entire app – and over half of that is code for the collection view and the image picker!

The advantage it has compared to traditional data sharing over Wi-Fi is that multipeer can use an existing Wi-Fi network, or can silently create a new Wi-Fi network or even a Bluetooth network depending on what's available. All this is an implementation detail that Apple solves on your behalf – we don’t have to care how it works.


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.

Review – Project 25: Selfie Share – Hacking with Swift

Interactive tests that help gauge your progress learning Swift

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. Show an alert when a user has disconnected from our multipeer network. Something like “Paul’s iPhone has disconnected” is enough.
  2. Try sending text messages across the network. You can create a Data from a string using Data(yourString.utf8), and convert a Data back to a string by using String(decoding: yourData, as: UTF8.self).
  3. Add a button that shows an alert controller listing the names of all devices currently connected to the session – use the connectedPeers property of your session to find that information.

이찬희 (MarkiiimarK)
Never Stop Learning.