Category: Blog, iOS, Development

How to spice up your app with iOS 10 magic?

Since September 7th iOS 10 Golden Master is available. That means in a few days there should be also the first initial public release of it. And that’s pretty awesome. I really enjoyed all the previous betas on my iPhone and can’t wait for the public seed available for everyone! But what does it mean for developers?

Probably you know almost everything about iOS 10 brand new features, but if you missed a recent few months, you can catch up by reading Paweł’s post about incoming changes.

Back to the topic, I’d like to show you how to prepare your mobile app for iOS 10. In general, the transition should be smooth and easy, but there are some new API that you can use to make your app even better! Of course, all of them require iOS 10, but remember that new iOS adoption rate is terrific. I suppose that it is going to be around 75% at the end of the year. Also, you need Xcode 8 and that means you need to upgrade your Swift codebase to 2.3 or 3.0. I assume an instant upgrade to 3.0 could cause many troubles, especially if you use rarely the updated libraries. Migration to Swift 2.3 should be pretty easy as it’s more like evolution, not revolution. Nevertheless keep in mind that you should backup your code before migration, especially if you don’t use Git (what!?) or other version control system.

Privacy

Zrzut ekranu 2016-09-06 o 13.41.22

Not fancy, but really important and possibly easy to omit. Since iOS 10 you have to declare a purpose shown to the user when the use of protected data classes (like photos, contacts or calendars) in Info.plist. It was possible to declare this in the previous releases but now it’s mandatory. If you don’t include the relevant purpose string keys, your app exits only when it tries to access the data.

SiriKit

Integration with Siri is quite easy, especially if your app has only one main functionality. Great for Uber, still cool for Spotify, but almost impossible for Gmail, Instagram or Tinder. SiriKit handles given intents to make your app talkative. Literally.

In fact, I’m not a big Siri fan, but it could be useful, though. There is available a WWDC session about SiriKit, but one of Droids On Roids teammates promised that he’ll review it, prepare some sample testing and then hopefully write a post. Stay tuned!

Messages

ios10stickers

Stickers look cool and simple pack with them is as easy as adding an extension to your app. It contains .xcstickers folder similar to .xcassets where it stores stickers as basic only one resolution images.

User Notifications

At the very first glance, iOS 10 notifications remain the same as always. Although thanks to the UserNotifications framework are much easier to implement and give more possibilities. For example, Messages let you see the last few messages on the lock screen and Apple showed an Uber notification with a live map presenting your driver position like in the regular app. In addition, there’re some new 3D Touch gestures i.e. to expand a notification.

Unfortunately, that means classes such as UILocalNotificationUIUserNotificationAction UIUserNotificationCategory and UIUserNotificationSettings are deprecated. So here goes the new UserNotifications framework documentation – helpful if you target iOS 10 or newer. Crazy this day, but in the next year?

Speech Recognition

Speech recognition in apps was always a trouble. There is SpeechKit by Nuance, but the lack of native iOS solution was disappointing. Since iOS 10 there is a Speech framework. It uses SFSpeechRecognizer to perform speech transcription of both real-time (but not constant; it only lasts about a minute at a time) and recorded audio (much easier, requires literally 5 LoC). Remember that this requires granted user permission and you must add NSSpeechRecognitionUsageDescription and NSMicrophoneUsageDescription keys to yours Info.plist.

Also keep in mind that Apple limits speech recognition per device and per app. The limit is not known, but be careful, especially that speech recognition uses a lot of power and data.

CallKit

CallKit lets VoIP apps integrate with the iPhone UI in the same way the Phone app does. Imagine Skype or maybe even Slack calling on the lock screen – great, huh?

CallKit

Screen 1: The way VoIP apps let you know about the incoming call. Screens 2-3: The way VoIP apps could use in iOS 10 to great integrate with UI. Source: developer.apple.com.

Moreover, CallKit also introduces app extensions that enable call blocking and caller identification.

Tiny, cute things

That’s a lot, but not all of the magic yet. iOS 10 and Xcode 8 comes with a lot great small things making apps and developing better.

  • Core Data has much better integration with Xcode and let you enable automatically generating and updating the NSManagedObjects,
  • iOS 10 tries to make user experience with True Tone Displays (available in iPad Pro) even better thanks to UIWhitePointAdaptivityStyle property in Info.plist. Depending on setting it gives stronger (i.e. reading) or weaker (i.e. multimedia) white point adaptivity than default,
  • The new DataSourcePrefetching protocols improve the table view and collection view scrolling experience (similar to Preheat + Nuke libraries),
  • Core Image supports RAW image files on iOS devices that use the A8 or newer CPU and introduces five new CIFilters,
  • Core Motion introduces pedometer events through CMPedometer API on supported devices,
  • a bunch of little enhancements too.

I’m pretty sure that in the next few weeks only the top apps would start to use some of the new great iOS 10 APIs. But later this and the next year we’ll observe more and more apps falling in love with iOS 10 as quickly as I did.

About the author

Piotr Sochalewski

Piotr Sochalewski

Droids On Roids iOS Developer