Next Steps

You’ve learned so much to get to this point, but there’s a lot more you can master in the iOS SDK. Where to go from here depends in part where you want to focus your interests. The platform is so large, it’s possible to be a generalist with an interest in many different iOS technologies, but also very rewarding to focus on a few specific areas. We’ll finish up with a look ahead to some directions you might want to go from here.

Networking

Our Twitter example was made much easier with the Social framework, though we did get to make pretty much raw web-service calls to Twitter REST endpoints with the SLRequest class. Of course, many iOS apps call web APIs as their basic functionality and aren’t using the Social framework. For general-purpose networking, the first place to look is in Foundation, specifically at the NSURLSession class and its various helper classes. NSURLSession offers performant, asynchronous networking that lets you work pretty much the way we did with Twitter: compose a request, send it off, parse the response in a closure, and pull out the returned NSData.

Networking is an area where third-party frameworks have won over a lot of iOS developers. One of the most popular is AFNetworking,[9] and its more Swift-friendly equivalent, Alamofire. [10]

Productivity

Many iOS apps help users get the most value out of their data: finances; appointments; and various kinds of personal records, from contacts to comic book collections. For these productivity applications, you may want to learn Foundation’s UIDocument class, which is the cornerstone of saving documents to the local filesystem or iCloud. Another option is Core Data, a data persistence framework that provides object-relational mapping: the power and speed of a database with the simplicity and elegance of an object model.

Some of the user’s data is also exposed to apps via iOS frameworks. You already saw how the Photos framework lets us work with the user’s photo library. The Contacts framework lets you work with the Address Book entries, while the MessageUI framework allows apps to compose email or SMS/iMessage posts. This way, your app has the ability to provide access to the user’s personal data and organizational features, without leaving your app in favor of built-in Apple apps like Contacts, Mail, and Messages.

Games

Games are among the most popular apps on the iOS platform, and there are lots of ways to get started. For 2D games, Sprite Kit offers a great place to get started, by letting you focus on the design, physics, and gameplay, while handling the drawing, animation, and collision detection for you.

2D graphics can also be created with Core Graphics, the system framework for vector-based drawing.

3D games are a stiff challenge, but frameworks exist here to help as well. For cross-platform code, the OpenGL ES library is a good place to start, with lots of resources and sample code for drawing 3D graphics. The newer Metal framework offers higher performance, at the price of being limited to Apple platforms, because it gets its performance gains by cutting out cross-platform abstractions and working directly and explicitly with the graphics chipsets found on iOS devices.

Media

iOS devices are popular for watching video and listening to audio: music, podcasts, movies, TV shows, livestreams…it’s hard to find an iOS user who doesn’t enjoy at least one of these. Most media developers should start with AV Foundation, which offers capture, editing, export, and playback of both audio and video. Playback support includes local files, remote URLs, and streams using the HTTP Live Streaming protocol. Media developers can also use the Media Player framework to access the music library on the device.

For more advanced media processing needs, you can drop down to the lower-level media processing frameworks, Core Video and Core Audio, which offer more power but also much more complexity.

For a bigger challenge and a bigger screen, tvOS is an iOS-based platform for writing apps for Apple TV. While the interaction model with a remote is different than the touch-based gestures of iPhone and iPad screens, many of the APIs will be familiar.

Device-Specific Features

Finally, there are a number of frameworks that exist specifically to provide access to the unique hardware on iOS devices. HealthKit is the first stop for developers interested in physical data collected by sensors like the step sensor in the iPhone or the heart-rate sensor in the Apple Watch. Core Motion provides access to the accelerometer and gyroscope data, allowing developers to react to the motion and orientation of the device as the user handles it.

And it’s not just the iOS devices themselves anymore. HomeKit allows your app to interact with Internet-of-things devices that support Apple’s HomeKit standards. And Core Location, which helps your app figure out where in the world it is, can work with iBeacons, which are used in indoor positioning systems, like helping customers find their way around a store.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.234.46