Swift's advanced collections can help you model more complex objects in your apps and create an API that is easier to understand and use. In this post, I model a chessboard using Swift's subscripts and also cover tuples and multidimensional arrays!
If you find it more convenient to listen to some text on your iPhone or iPad rather than read it, you can easily enable that capability. You might, for example, want your device to read a web page or ebook or other document to you as you drive. While this feature has been available for some time, note that iOS 8 gives a convenient new option for invoking speech.
You know when you're entering a long number in your iPhone's Calculator app and you mistype a digit or two? You don't actually have to hit clear and start over.
You can easily adjust the voice navigation volume in Maps up or down while using the navigation app by pressing the volume buttons on the side of your iPhone. But you probably don't want to discover you can't hear the voice navigation in Apple Maps and then have to mess with your phone while you're barrelling down the highway. A safer way to make sure the voice navigation is always at the right volume is to change Map's default volume.
If you share an iDevice with others, you may wish to keep parts of your web browsing history private. But what if you forget to turn on Private Browsing? You could clear your entire browsing history, but nothing says "I'm hiding things from you" more effectively. Fortunately iOS 8 offers more options for clearing your history more selectively.
There's no need for most apps to track your location at all times. However, before iOS 8, the only choices you had for location tracking was Always or Never. So if you wanted your photos to be tagged with the location in which they were taken, you had to allow the Camera app to always track your location, which could drain your battery and use your data unnecessarily. Now, iOS 8 allows you to set certain apps to only track your location while the app is in use.
In part 2 of this post on Swift's protocols, you will learn practical uses for declaring custom protocols in your own apps, and learn further how they improve the architecture of your apps and make them easier to enhance and extend.
In part 1 of this post, I demonstrated how to implement existing Cocoa Touch protocols in your apps. Now you'll learn how and why to create your very own. First, we need to cover the basic construction of a Swift protocol.
If you want to quickly call, FaceTime, or text a contact, there's no need to open any of the related apps. Those who have iOS 8 on their iPhone can quickly access Favorite and Recent contacts via the App Switcher.
As anyone who has used to Siri to make calls, search the web, or send messages knows, Siri doesn't always understand what you say. This can be followed by increasing frustration levels if Siri fails over and over to understand your voice corrections. But when Siri gets it wrong, you don't have to repeat yourself. Instead, you can edit your query via typing.
Thanks to iOS 8, Apple lovers finally have access to widgets on their iPhones. But users will find some widgets more useful than others. Maximize their utility by deleting widgets you don't need to see in the Today view in Notifications and arranging the rest in the most convenient order.
You know the feeling—you hand your phone over to a friend or family member, intending to show them a single picture, and suddenly you’re watching in horror as they begin swiping through your 50+ selfies or stumble across your hoard of risqué photos. Thankfully, iOS 8 has introduced an easy way for you to hide your shots from prying eyes with its new "hide" feature.
Stop checking your inbox every five minutes for that reply to the email you sent. Enable reply notifications instead so you receive an alert whenever a reply in an important email thread arrives.
You don't have to leave a group message just because you want your iPhone to stop buzzing with new message notifications. Instead you can turn on Do Not Disturb for that message thread and read all the messages about planning your brother-in-law's birthday party later.
Protocols are a powerful, advanced tool that help make your apps easier to design and extend. They define standard behavior in classes that are not necessarily related. Protocols used together with delegates allow you to create classes with a well-balanced load of responsibilities.
Using Find My iPhone can significantly increase the odds that your lost iPhone will be returned to you. But it won't work if the battery is dead. With iOS 8, you now have the ability to have your missing iPhone send its location to Apple just before the battery dies. This is probably most useful when looking for a lost iPhone. A stolen phone is more likely to be moved after the battery dies.
Messages can take up a surprising amount of your iPhone's storage capacity and the reason is all those cute pictures of dogs and kids that you've been texting back and forth with your friends. Fortunately, it's easy to delete attachments from Messages without deleting the conversation.
I like the features of Safari in iOS 8. In a previous tip I showed how to request the desktop version of a site by tapping in the address bar and then dragging down on the Favorites window that pops up. I also just learned of a quick way to add the current page to Favorites, to your reading list, or to shared links.
I like Apple's Maps app, but a number of times it's taken me to a location that simply didn't exist: an Indian restaurant, a zoo, a hotel in a small town, a Chinese restaurant. I diligently follow Siri's directions and when she says I've arrived, the establishment in question is nowhere to be seen. And in several of these cases probably never existed. If you've had similar problems and prefer maps from third parties such as Google, you can now conveniently access these maps from within Apple's Maps app.
Often when you're searching the web for some particular bit of information, your search pulls up a long page of text. But you then have no idea where on that page to find the information you're looking for. The next step is to search within the page. The way to do that on iOS devices is simple, but not obvious.
In previous posts I have touched on inheritance in Swift. In this post, I'm going to be diving deeper and giving you a fuller picture of how inheritance works in Swift, and how you can use it to create apps that are easy to extend when you need to add new functionality. Along the way, you will also learn about the important concept of polymorphism and learn how to use Xcode's new playgrounds!
Want more? Get our weekly newsletter: