iOS 5 has been officially released, and iOS developers are eager to begin making use of the many new features available in the iOS 5 SDK. In this article, industry gurus Brandon Trebitowski and Collin Ruffenach reflect on the opportunities, efficiencies, and most exciting features of the latest SDK. This post is a must read for all iOS SDK developers!
iOS 5 Overview
With the release of iOS 5 SDK, the iOS development platform has reached a new level of maturity. It is apparent with this SDK release that Apple is really listening to the needs and requests of the development community. Not only has Apple recognized the common goals and pain-points expressed by iOS developers, but they have also sought to provide tools at the SDK level that will solve many of the common problems we face and completely alleviate some of the most frustrating pitfalls.
With the latest SDK, one thing is certain: it has never been more exciting to be an iOS developer! This article will provide you with a basic overview of the enhancements that we find the most exciting.
iCloud Storage APIs
iCloud storage is a huge new feature in iOS 5. It enables developers to sync application data across platforms automatically. There are two forms that this can take: key-value and document store.
While key-value will provide a nice cloud version of NSUserDefaults, it's very space constrained. The maximum amount of data that can be stored is 64KB. That being the case, Apple suggests only using this storage mechanism for small amounts of meta information, such as the last page number read in a reader application. Another problem with key-value cloud storage is that the developer has no control over conflict resolution. Whenever a conflict occurs, the key-value with the latest timestamp is always used. In a real-world application, this may or may not be the right choice.
In my opinion, the document store is going to be the huge feature here. It is my understanding that you will be able to sync any document that you choose in the cloud. This will make it much easier to create things such as notes and to-do apps with persistent, distributed data. This could be easily accomplished by, say, choosing to sync your Sqlite database or Core Data store. Unlike the key-value syncing method, with document store developers will be able to define their own conflict resolution scheme.
I feel like Apple has things almost right with their iCloud implementation. The low-hanging fruit I believe they are missing is the ability for user interaction between their data. If they were to provide such mechanisms, then online games could be completely facilitated through iCloud.
Official Twitter Support
iOS 5 marks the beginning of what seems to be a fairly serious relationship with Twitter. They're not "Facebook official" or anything, but they're going to be seeing a lot of each other over the next few releases. Apple has had difficulty striking the right cord in the social market. Ping seems to be a bit of a miss, and it looks like Apple is ready to play ball with Twitter rather than getting into the game themselves. This will be welcomed news to many developers. After the OAuthcalypse, Twitter integration for any given application became much more complex. With this SDK release, iOS essentially manages Twitter authentication on your behalf with users being able to enable or disable an app's Twitter authentication in the iOS System Preferences. Apple now provides a common view controller for creating Tweets as well.
Within address book, Apple has included a new feature to scrape Twitter for your contacts profile pictures. It works quite well and speaks to the other types of integration we may see from app developers. This all also occurs on the heels of Twitter photo upload integration, which is also facilitated by the new Twitter.framework. Overall, this makes reading and writing to Twitter exponentially easier and looks to be something we will see even more from in upcoming releases.
With the dawn of Xcode 4.0, Interface Builder (IB) became a much more integral part of the development experience as it is now a component of Xcode rather than a separate application. This trend continues with the enhancement of the Interface Builder Interface and the introduction of Storyboarding.
When it comes to changes to the actual IB interface, Xcode 4.2 tries to foster a tighter connection between the code representing IBOutlets and IBActions and their visual representation in Xcode. This means that you can actually connect IBAction method declarations to the buttons that will fire them and IBOutlet declarations to the actual UI Component they reference.
Aside from this, you will also see GUI representations for things like UIGestureRecognizers, GLKit Views and Controllers, and the new UIStepper.
Storyboarding is the other big new story when it comes to IB. Put simply, working with story boards means never having to call
popViewController:animated again. All of the flow of moving view controllers onto and off of a navigation controller, as well as presenting views modally, can be done visually through Storyboarding.
Overall, this enables a visualization of every possible screen flow in your application, cuts down on code, and, most importantly, allows non-developers to contribute their input in a usable form. A lot of times the conversion from concept/creative to implementation/code gets lost in translation. With the new storyboard approach, designers can create flow representations that will actually cut down on the amount of work required by the developers of the project.
Automatic Reference Counting (ARC)
Since the very first release of iOS, memory management has been a huge pain point for developers. I would say the majority of application crashes are due to mismanagement of memory. ARC aims to solve this by completely taking the reference counting away from the developers. All memory related methods (
autorelease, etc.) have now been deprecated in order to take full advantage of ARC.
There are some huge advantages to using ARC. First off, it drastically lowers the barrier for newer developers on the iOS platform, especially developers coming from platforms like Android that make use of Garbage Collection. It will also reduce the number of lines of code developers need to write as you no longer need the memory calls to modify the retain count. My only concern with ARC is that developers might now never learn the importance of proper memory management. This could lead to lazy programming practices and might possibly create an increase in memory hogging applications.
The Core Image Framework
Core Image, a framework that has been available to OS X developers for awhile now, is finally available as part of the iOS 5 SDK. It enables developers to easily use a huge library of photo and video manipulation filters, and it also provides a simple language for them to create their own filters. It's now incredibly easy to perform such tasks as tiling, masking, blending, and composition of multiple images.
I was really intrigued to see that the filter language looks like basic C and is loaded at runtime. Given this portability, I wouldn't be surprised if we see a third party website/store that sells these filters in the near future.
For an example of Core Image filter power, check out this filter that adds a crystalized effect:
Schemes and Git Integration
With the release of iOS 5 publicly, Xcode will also get an upgrade to 4.2. Xcode 4.2 has a lot of enhancements from Xcode 4.1, mostly related to the new SDK and iOS 5 features. A non-SDK based enhancement is the refinement to Schemes and GIT integration. GIT has become the prevalent source control technology among iPhone developers and it is awesome to have Xcode take advantage of all the great things GIT has to offer. Schemes are the new place you keep project configuration type things. This covers what release you are building for, linked frameworks, build scripts, etc. Schemes can be shared and generally make things like testing and project sharing among teams easier.
The bigger news here is the deep GIT and SVN integration. Apple has taken all the abilities of source control software and built visualizations of how they work into Xcode. Files are all constantly marked with updates as to their status (Added/Modified). Every file can be shown in historical view. In historical view you will get 2 panes with a timeline in the center where you can navigate backwards in time for the file. There are complete blame views, commit and push entry interfaces, and even branch and conflict resolution displays. Integration with GITHub is straightforward too. All in all, this is a great enhancement. Make sure you take a look at this document from Apple, that highlights all the features in detail.
NewsStand is yet another example of the maturation of the iOS platform. Throughout the last few releases, Apple has begun to create offerings to address common developer pain-points in the "sandbox" environment they have made. Game Center and iCloud are some generic examples of this, but NewsStand represents an investment from Apple in facilitating special needs of a specific type of application.
The NewsStand framework allows developers to do two things. First, developers can send a push notification to their applications that will launch them in the background and download the latest issue. Second, developers can set special icons to represent their application in the NewsStand view. NewsStand applications will all reside in a special NewsStand folder, and this will create a common native object representation for the "Library" of issues on the device.
What remains unclear here is what, if any, type of certification will be required to be a NewsStand application. Will Engadget be able to create a NewStand type application? I'm sure many blogs would like the ability to distribute content and have it download in the background for their iOS 5+ users. There does seem to be a restriction that only one background download push notification is allowed per 24 hours, it will be interesting to see if any of the internet-only media outlets take advantage of this new framework.
Custom Appearance for UIKit Controls
If you have ever looked at a design document, compared that with what is provided with the Apple UIKit defaults, and then had to completely roll your own implementation to match the designers intentions, then you will be excited for the introduction of custom UIKit controls! All of the major controls now allow their background image, tint color, and title position properties to be easily customized. I'm particularly excited about the ability to set the background image property. I have spent hours recreating a UISwitch simply to have it look a little different.
This is a great step forward in terms of application customization. I'm sure we will start seeing a lot more clever integration of Apple UI components. Along those same lines, we will also see some people totally making Apple's beautiful components look hideous.
As you can tell, iOS 5 is a big release. It has deep enhancements to both the SDK and the IDE we all develop with. While we did our best to hit the big points in this article, there are TONS of other features that we haven't been able to talk about. Here is a rapid fire list of some additional noteworthy changes:
- New JSON parser: Unfortunately, initial tests seem to show that it is still slower than JSONKit. However, the new parser does have streaming JSON capability!
- Low level Bluetooth access: You may finally be able to make that cool Arduino project you've been thinking about!
- Game Kit turn-based state storage: now you don't have to worry about storing a game's turn-based data, making these kinds of games much easier to create! This is kind of like an auxiliary to iCloud, optimized for turn-based gaming.
- Background process enhancements: External accessories can continue to function in the background, which will enable a lot of device accessories that were previously not feasible.
- Core Data ordering: You either relate to this one or you don't.
- Official vCard support: Nice to have an easier format to work with.
- UIAlertViews with UITextFields: And yes, they support passwords now too!
- Airplay mirroring: It is difficult to tell if the Apple TV will ever gain a solid market footing, but it is definitely cool to essentially have a second display to present an iOS interface on.
So, what are you waiting for? Go get iOS 5 and take advantage of all these new features!
Vote for More iOS 5 Tutorials
In the weeks ahead, Mobiletuts+ will be providing in-depth tutorials on many of the new iOS 5 SDK features, including Storyboarding, the Twitter Framework, the Core Image Framework, the NewsStand Support, and more!
Tell us what to write about by voting below for the topics you're most interesting in learning about:
About the Authors
Brandon Trebitowski is a software developer and author from Albuquerque, New Mexico. Brandon holds a BS in Computer Science from The University of New Mexico and has been developing software for the last 10 years. In August of 2008, he started iCodeBlog.com to teach aspiring developers how to write software for the iPhone. After the blog was acquired by ELC Technologies in December of 2008, he began working full time for them developing mobile software.
Brandon has since coauthored an iOS development book called iOS 4 In Action and has become the Lead Mobile Applications Developer at ELC Technologies. He has a strong passion for programming and loves sharing it with others.
You can follow Brandon's postings on his twitter @brandontreb.
Want to get the most up to date guide on the iOS SDK? Grab iOS 4 in Action, which Brandon contributed to.
Collin Ruffenach is an iOS Developer with ELC Technologies based in Portland, OR. Collin earned a B.S. in Computer Systems Engineering and an M.S. in Computer Science in 2010 from Arizona State University. His research revolved around iOS development in home automation based scenarios.
Since 2008, Collin has been contributing to iCodeBlog, where he has been posting both articles and screencasts on different iOS programming topics since the iOS SDK was first released. Collin recently contributed to a new book called Objective-C Fundamentals with Manning Publishing.
You can follow Collin's postings on his twitter: @cruffenach.
Want to refine those Objective-C skills? Check out Objective-C Fundamentals, which Collin contributed to.
Thanks for reading!
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post