Ten Fantastic Objective-C Libraries for iPhone Developers

Ten Fantastic Objective-C Libraries for iPhone Developers

After having spent more than a decade working almost exclusively with the web, I decided to branch out and try my hand at something entirely new: iPhone development. The transition was surprisingly difficult, largely because the Objective-C community doesn’t yet enjoy a mature open source software ecosystem available to languages such as Ruby (via Bundler), PHP (via Composer), or Perl (via CPAN). The number of quality third-party libraries does however continue to grow, and thanks to the popular CocoaPods library dependency manager it’s easier than ever to incorporate these libraries into your iOS and OSX applications.

If you’re new to or considering jumping into Objective-C development, then chances are you’re similarly inclined to find quality libraries in order to speed your own development activity. In this article I’ll highlight ten Objective-C libraries I’ve come to find indispensable while working on my first iPhone application. Obviously this merely scratches the surface in terms of what’s available through CocoaPods, so be sure to head over to the CocoaPods website and spend some time searching the repository to learn what else is available.

Google Maps SDK for iOS

The app I’m currently working on is a niche travel guide, and integrates numerous maps for helping the user identify points of interest. Of course, Apple offers native support for integrating Apple Maps, however as I already have years of experience working with the Google Maps API it seemed prudent to at least take a look at the Google Maps SDK for iOS in the hopes of being able to adapt this knowledge and experience to iOS development. I wasn’t disappointed as many of the concepts and syntactical constructs are very similar to those used within the Google Maps JavaScript API.

As far as libraries go, the Google Maps SDK for iOS requires a fair bit of project configuration in order to work properly within the confines of your project. However, these steps are fairly straightforward, and followed closely you’ll be displaying maps within your iOS application in no time flat.

FMDB

Newcomers to iOS development might be surprised to learn that the powerful SQLite relational database is available by default for your application’s data persistence needs. Most developers will opt to use the Core Data framework for such matters, a general purpose data management solution which eases the pain otherwise incurred managing persisted data within your iOS applications, Core Data’s learning curve is admittedly steep. If your data persistence needs are fairly simplistic, then you might consider taking a look at the Objective-C SQLite wrapper FMDB.

Installing and using FMDB is surprisingly easy. For starters, you have the luxury of using an existing SQLite database, making it available to your application simply by copying the database into your application directory (there is no such convenience available when working with CoreData, at least without first making some adjustments to the database structure). Once available, the process required to retrieve or modify data isn’t particularly dissimilar to that used when using similar libraries within web development. For instance, the following is an admittedly simplified by working snippet which opens a SQLite database named locations.sqlite and retrieves a result set containing all locations found in a table named locations:

NSArray *docPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);NSString *documentsDir = [docPaths objectAtIndex:0];NSString *dbPath = [documentsDir   stringByAppendingPathComponent:@"locations.sqlite"];FMDatabase *database = [FMDatabase databaseWithPath:dbPath];[database open];FMResultSet *results = [database executeQuery:@"SELECT id, name FROM locations"];

While the simplicity of FMDB is indeed attractive, particularly when compared to Core Data’s relative complexity, in my admittedly limited experience (and based on the advice of several far more knowledgeable colleagues) it seems apparent that sticking to Apple’s native Core Data offering is ideal in most situations. However FMDB certainly has its place, and warrants a look if you’re planning on persisting application data.

Mogenerator

Presuming you do heed the last section’s closing advice and adopt Core Data, you will undoubtedly want to take a look at Mogenerator, a fantastic library which among other things resolves one wildly annoying inconvenience associated with using Core Data which has to do with how Core Data entities are managed. Thanks to an Xcode tool known as the Core Data Model Editor, you can create and manage your model objects, which are then made available as classes which inherit from the NSManagedObject class. These classes contain a variety of properties and methods, just as you would expect. However, you cannotenhance these classes by for instance adding additional convenience methods, because one or more of these classes will be overwritten should you later decide to modify your schema via the Core Data Model Editor.

Mogenerator solves this problem by generating two files for each entity, one which continues to mirror the changes made through the Core Data Model Editor, and a second which you can use to manage custom changes made to the entity (such as adding methods and other useful accoutrements).

Although I think this feature alone makes Mogenerator worth using, it also happens to offer several other conveniences, including a variety of useful helper methods which further ease some of the pain incurred when using Core Data.

Incidentally, Mogenerator departs from the other libraries discussed in this article in that it is the only one not available via CocoaPods. Instead, you’ll install it via a DMG installer, which you can download from here.

AFNetworking

Although nobody is keeping score, AFNetworking is possibly the most popular Objective-C library on the planet. According to the AFNetworking developers, the library is a key part of some of the world’s most popular iOS apps, among them Vine and Pinterest. So what’s all the hubbub about? AFNetworking is in essence a networking library, providing you with the ability to perform common networking tasks such as retrieving and parsing JSON, downloading images, and communicating with web services.

While AFNetworking provides you with the framework for implementing any conceivable sort of network-related feature, a growing number of AFNetworking extensions likely make your task even easier, offering solutions for interacting with the Amazon S3 API, parsing iCalendars, and measuring connection speed.

RestKit

Logically many of today’s iOS applications will interact with an organization’s RESTful web service. While building such services using web frameworks such as Rails is increasingly simple thanks to ample documentation and robust framework features, building customer Objective-C solutions for consuming these services is another matter entirely. The RestKit library erases much of the complexity associated with building Objective-C clients by providing an object mapping solution which serves as a bridge between Core Data and the RESTful resources which comprise the web service.

If you’d like to learn more about what RestKit has to offer, the RestKit GitHub repository offers a fantastic tutorial complete with a sample project. I highly recommend using this resource as your starting point if you’d like to know more about what’s possible using this powerful framework.

Nui

Without question dealing with iOS layouts and UI stylization is one of the most frustrating aspects of transitioning from web to iOS development. Web developers have an infinite number of tools at their disposal for building and managing web interfaces, whereas the task is often frightfully constraining for iOS developers lacking adequate design skills. Enter Nui, a library which gives you the ability to stylize UI elements using a style sheet. Using Nui you can stylize your iOS app by adapting the very same knowledge you’ve accumulated over the years building web sites, using CSS styles to define font, button, and background styling, among others.

FontAwesome+iOS

You’ll undoubtedly want to incorporate icons of various sorts into your iOS application, using them to spruce up your interface and provide users with visual cues pertaining to widgets associated with tasks such as application navigation, data deletion, audio/video playback, and content synchronization. Perhaps the de facto such icon set is Font Awesome, the iconic font bundled with Bootstrap. iOS developers can easily incorporate the icons available via the Font Awesome font into their apps thanks to the FontAwesome+iOS library.

After configuring FontAwesome+iOS (see the README for instructions), you can easily add any of the hundreds of vector-based icons made available via the Font Awesome set (see the list here). For instance, the following bit of code creates the screen presented in Figure 1.

 [bigButton setTitle:@"Go to My GitHub Page" forState:UIControlStateNormal];[labelHello setFont:[UIFont fontWithName:kFontAwesomeFamilyName size:100]];labelHello.text = [NSString fontAwesomeIconStringForIconIdentifier:@"icon-github"];[labelHello setTextAlignment:NSTextAlignmentCenter]; 

A sample FontAwesome screen
Figure 1. A sample screen created using Font Awesome’s GitHub icon.

Incidentally, FontAwesome+iOS isn’t the only option for adding high quality icons to your iOS application. For instance my current project integrates the amazing GLYPHICONS library, which at a cost of $59 as of the time of this writing is a real bargain considering it places almost 500 icons at your disposal.

String Stylization with TTTAttributedLabel and FormatterKit

Thanks to view helpers, CSS and other formatting solutions it’s fairly trivial to stylize text within a web application, adding padding, indentation, and shadows, not to mention humanizing units (displaying 1,000 KB as 0.97 MB, for instance), and converting numbers (cardinals to ordinals, for instance).

There are two great libraries capable of fulfilling these sorts of needs and more within your iOS applications, including TTTAttributedLabel and FormatterKit. TTTAttributedLabel offers a wide array of features useful for string formatting, including paragraph style indentation, line height adjustments, shadows, and insets, as well as text context type detection capabilities for properly formatting URLs, phone numbers, and dates, among others.

FormatterKit offers a number of formatting conveniences largely related to the humanization of data such as mailing addresses, numbers, and arrays. For instance, you can use FormatterKit to turn an array such as [@”AM”, @”FM”, @”Shortwave”] into the user-friendly string, “AM, FM, and Shortwave”.

ViewDeck

There are several iOS apps I use every single day which include a user interface feature known as a “sliding view” (including AnyList, an indispensable app my wife and I use all the time). An example of AnyList’s sliding view UI is presented in Figure 2.

A sample sliding view UI
Figure 2. An example sliding view UI (from the AnyList application)

Indeed this is such a commonly desired feature that there are numerous open source implementations, however ViewDeck seems to be a particularly popular solution, having garnered quite a GitHub following. Although I haven’t yet had the opportunity to integrate ViewDeck into an application, I’d imagine its popularity largely has to do with its numerous features, including the ability to create left- and right-side side views, set the ledge size, and animate the movement in a variety of ways.

Conclusion

Hopefully this short list of popular libraries will be of some help in ramping up your Objective-C development. Do you use a particular Objective-C library not listed here? Tell us about it in the comments.

devx-admin

devx-admin

Share the Post:
Global Layoffs

Tech Layoffs Are Getting Worse Globally

Since the start of 2023, the global technology sector has experienced a significant rise in layoffs, with over 236,000 workers being let go by 1,019

Cybersecurity Banking Revolution

Digital Banking Needs Cybersecurity

The banking, financial, and insurance (BFSI) sectors are pioneers in digital transformation, using web applications and application programming interfaces (APIs) to provide seamless services to

FinTech Leadership

Terry Clune’s Fintech Empire

Over the past 30 years, Terry Clune has built a remarkable business empire, with CluneTech at the helm. The CEO and Founder has successfully created

The Role Of AI Within A Web Design Agency?

In the digital age, the role of Artificial Intelligence (AI) in web design is rapidly evolving, transitioning from a futuristic concept to practical tools used

Global Layoffs

Tech Layoffs Are Getting Worse Globally

Since the start of 2023, the global technology sector has experienced a significant rise in layoffs, with over 236,000 workers being let go by 1,019 tech firms, as per data

Huawei Electric Dazzle

Huawei Dazzles with Electric Vehicles and Wireless Earbuds

During a prominent unveiling event, Huawei, the Chinese telecommunications powerhouse, kept quiet about its enigmatic new 5G phone and alleged cutting-edge chip development. Instead, Huawei astounded the audience by presenting

Cybersecurity Banking Revolution

Digital Banking Needs Cybersecurity

The banking, financial, and insurance (BFSI) sectors are pioneers in digital transformation, using web applications and application programming interfaces (APIs) to provide seamless services to customers around the world. Rising

FinTech Leadership

Terry Clune’s Fintech Empire

Over the past 30 years, Terry Clune has built a remarkable business empire, with CluneTech at the helm. The CEO and Founder has successfully created eight fintech firms, attracting renowned

The Role Of AI Within A Web Design Agency?

In the digital age, the role of Artificial Intelligence (AI) in web design is rapidly evolving, transitioning from a futuristic concept to practical tools used in design, coding, content writing

Generative AI Revolution

Is Generative AI the Next Internet?

The increasing demand for Generative AI models has led to a surge in its adoption across diverse sectors, with healthcare, automotive, and financial services being among the top beneficiaries. These

Microsoft Laptop

The New Surface Laptop Studio 2 Is Nuts

The Surface Laptop Studio 2 is a dynamic and robust all-in-one laptop designed for creators and professionals alike. It features a 14.4″ touchscreen and a cutting-edge design that is over

5G Innovations

GPU-Accelerated 5G in Japan

NTT DOCOMO, a global telecommunications giant, is set to break new ground in the industry as it prepares to launch a GPU-accelerated 5G network in Japan. This innovative approach will

AI Ethics

AI Journalism: Balancing Integrity and Innovation

An op-ed, produced using Microsoft’s Bing Chat AI software, recently appeared in the St. Louis Post-Dispatch, discussing the potential concerns surrounding the employment of artificial intelligence (AI) in journalism. These

Savings Extravaganza

Big Deal Days Extravaganza

The highly awaited Big Deal Days event for October 2023 is nearly here, scheduled for the 10th and 11th. Similar to the previous year, this autumn sale has already created

Cisco Splunk Deal

Cisco Splunk Deal Sparks Tech Acquisition Frenzy

Cisco’s recent massive purchase of Splunk, an AI-powered cybersecurity firm, for $28 billion signals a potential boost in tech deals after a year of subdued mergers and acquisitions in the

Iran Drone Expansion

Iran’s Jet-Propelled Drone Reshapes Power Balance

Iran has recently unveiled a jet-propelled variant of its Shahed series drone, marking a significant advancement in the nation’s drone technology. The new drone is poised to reshape the regional

Solar Geoengineering

Did the Overshoot Commission Shoot Down Geoengineering?

The Overshoot Commission has recently released a comprehensive report that discusses the controversial topic of Solar Geoengineering, also known as Solar Radiation Modification (SRM). The Commission’s primary objective is to

Remote Learning

Revolutionizing Remote Learning for Success

School districts are preparing to reveal a substantial technological upgrade designed to significantly improve remote learning experiences for both educators and students amid the ongoing pandemic. This major investment, which

Revolutionary SABERS Transforming

SABERS Batteries Transforming Industries

Scientists John Connell and Yi Lin from NASA’s Solid-state Architecture Batteries for Enhanced Rechargeability and Safety (SABERS) project are working on experimental solid-state battery packs that could dramatically change the

Build a Website

How Much Does It Cost to Build a Website?

Are you wondering how much it costs to build a website? The approximated cost is based on several factors, including which add-ons and platforms you choose. For example, a self-hosted

Battery Investments

Battery Startups Attract Billion-Dollar Investments

In recent times, battery startups have experienced a significant boost in investments, with three businesses obtaining over $1 billion in funding within the last month. French company Verkor amassed $2.1

Copilot Revolution

Microsoft Copilot: A Suit of AI Features

Microsoft’s latest offering, Microsoft Copilot, aims to revolutionize the way we interact with technology. By integrating various AI capabilities, this all-in-one tool provides users with an improved experience that not

AI Girlfriend Craze

AI Girlfriend Craze Threatens Relationships

The surge in virtual AI girlfriends’ popularity is playing a role in the escalating issue of loneliness among young males, and this could have serious repercussions for America’s future. A

AIOps Innovations

Senser is Changing AIOps

Senser, an AIOps platform based in Tel Aviv, has introduced its groundbreaking AI-powered observability solution to support developers and operations teams in promptly pinpointing the root causes of service disruptions

Bebop Charging Stations

Check Out The New Bebob Battery Charging Stations

Bebob has introduced new 4- and 8-channel battery charging stations primarily aimed at rental companies, providing a convenient solution for clients with a large quantity of batteries. These wall-mountable and

Malyasian Networks

Malaysia’s Dual 5G Network Growth

On Wednesday, Malaysia’s Prime Minister Anwar Ibrahim announced the country’s plan to implement a dual 5G network strategy. This move is designed to achieve a more equitable incorporation of both

Advanced Drones Race

Pentagon’s Bold Race for Advanced Drones

The Pentagon has recently unveiled its ambitious strategy to acquire thousands of sophisticated drones within the next two years. This decision comes in response to Russia’s rapid utilization of airborne

Important Updates

You Need to See the New Microsoft Updates

Microsoft has recently announced a series of new features and updates across their applications, including Outlook, Microsoft Teams, and SharePoint. These new developments are centered around improving user experience, streamlining