Creating a simple music player with iOS

You want to play music or just some audio content with a simple UI within your app? There were several libraries for doing that: MusicPlayerViewController, MDAudioPlayerController and many more. But none of them seem to be active any more. If you are starting development on an app that includes a…

Switch to a new song/audio in background for iOS

If you have a music app, you might be using a code like this to play songs in your iOS app: - (void)next { // Find new index NSUInteger newIndex; // Create a new audio player for this index NSError *error = nil; AVAudioPlayer *newAudioPlayer =[[AVAudioPlayer alloc] initWithContentsOfURL:[(MDAudioFile *)[soundFiles objectAtIndex:selectedIndex] filePath]…

PromiseKit: Promises for iOS

Most of the apps today have to deal with lot of asynchronous stuff. If you do a lot of asynchronous NSURLRequests, Restkit's getObjectsAtPath:parameters:success:failure:, or even simple asynchronous UI actions (e.g. UIAlertView and UIActionSheet), I am sure you often see the code becoming ugly, wrapped inside asynchronous…

Push Notifications in iOS8

There have been some great changes to iOS notifications with the iOS8 update. This means that now you can send a payload of upto 2KB instead of the 256 bytes earlier. iOS8 also separates the silent and UI push notifications. It means that you can send notifications without any UI…

Nested Sections in UITableView

Sometimes, there might be cases where you would like to display nested sections in a UITableView. For example, consider an app organizing groups taxonomically like so Sports Bat-and-ball Baseball Softball Cricket Hockey Field Hockey Ice Hockey Roller Hockey Engineering Computer Science Software Engineer Electrical Engineer A UITableView really isn't designed…

Best Practices for Table View Data Sources

If you read objc.io, you already know what I am talking about, lighter view controllers. Table views are heavily used in iOS apps and most of the times, all the code for handling the data source goes right in the controller. As the app starts growing, the controllers become…