Building an Instagram-Like App with Parse and Swift

Parse, the mobile app platform, has one particularly interesting product: Parse Core. One of its features allows app developers to store data in the cloud, without worrying about setting up servers and designing a REST API. Parse Core is also locally backed, like Core Data, which makes it a very good solution for online-offline back-ends.

This tutorial explains how to create an app that’s backed by Parse. We’ll create an Instagram-like app with these features:

  1. Load data from Parse, store it locally.
  2. Save data to Parse, write it back to the cloud.
  3. Upvote, or like, pictures of cats.

The app will be entirely created with Swift, Apple’s new programming language for making iOS apps. Parse isn’t yet rewritten in Swift, so we’ll have to create a Bridging Header to work with it.

Paws - Parse Demo in Swift

This is what you’ll learn:

  • Working with Parse, retrieving and saving data in the cloud.
  • Integrating a Swift project with Objective-C frameworks, with Cocoapods.
  • Setting up views and a custom table view cell with Interface Builder.
  • Coding an entire app with Swift, from scratch.
  • Working with Auto Layout and constraints.
  • Using gesture recognizers, optionals, conditions, closures, properties, outlets and actions.

[Read more…]

A Swift Tutorial for Google Maps SDK

Working with maps in iOS consists of an entire programming chapter, as there are tons of things that a developer can do with them. From just presenting a location on a map to drawing a journey’s route with intermediate positions, or even exploiting a map’s possibilities in a completely different way, dealing with all these undoubtably is a great experience that leads to amazing results.

Up to iOS 5.1 (including that version as well), iOS was using the Google Mobile Maps service to provide access to maps and all the related services. Since then however, things changed and Apple introduced the Map Kit, a brand new framework completely built in-house, which is used until today. By the time Apple stopped using Google’s map services, Google decided to create its own Maps SDK for all platforms, including iOS, and that way to compete the Map kit or any other map SDKs that other platforms use. Right now, Google consist of a strong player in this field, as many developers use that SDK. So writing for the Google Maps SDK for iOS is something that definitely worths to be done.

Google Maps API for iOS

At the writing time of this tutorial, the Google Maps SDK for iOS is in the 1.9.2 version. It contains many features, the most of what’s included in the web version of maps, but on the other hand there are missing features as well that are unable to work on a mobile platform. The remarkable point is that in this version, the SDK is quite large in size (MB), and surely that’s something you have to consider if you want to copy the framework’s source files in your project. However, the features it offers are pretty interesting and important so to be rejected without second thought.

[Read more…]

Building a Simple Share Extension in iOS 8 App

Share extensions, introduced in iOS 8, give users an easy and convenient way to share content with other entities, such as social sharing websites or upload services. Previously, sharing content usually entailed switching from one app to another, for example, while surfing in Safari, if you wanted to share a URL, you would copy it, switch to the app you wanted to save or share it in, perform the action and then resume surfing in Safari. With share extensions, users will now be able to share content to your service direct from within the app they are using, be it Safari, Photos or other apps. This isn’t limited to system applications. Any custom application that presents an instance of the UIActivityViewController class will be able to see your sharing extension if you built your extension so that it can handle the file type provided by that application.

We are going to build a Share extension that shares photos to a social networking site. To make things simple we’ll use Imgur for this as it allows users to upload images anonymously (without the images being linked to an account).

Share Extension

Just like any other extension, a share extension cannot be a stand alone app; it must come bundled with a container app. I’ve created a starter project that will be our container app. Download it to follow along.

[Read more…]

Creating Your Own Custom Controls Using IBDesignable in Xcode 6

Have you tried to create a custom control in older versions of Xcode? It’s not that easy. What makes it so hard is that you couldn’t see your design in the Interface Builder. Every time you want to review the design changes, you can only test the control in the simulator. That’s troublesome. You would probably need to spend hours and hours on designing a single component.

With the release of Xcode 6, Apple introduced a new feature known as IBDesignable and IBInspectable for developers to build custom controls and allowed us to live preview the design right in the Interface Builder. Quite obviously, this is a huge productivity benefit.

In this tutorial, I will give you an introduction to IBDesignable and IBInspectable, and show you guys how to take advantage of the new feature. There is no better way to elaborate a feature than creating a demo. So we will build a custom interface called “Rainbow” together.

Rainbow

[Read more…]

App Showcase #3: FindMoreInternships by Vin Lee

As you know, from time to time, we feature apps developed by our readers, in particular for those who released their very first app. Here comes to the third app showcase. This time we talked to Vin Lee, the app developer behind FindMoreInternships, an app that provides internship information for college and high school students.

Vin will share with us how he came up with the app idea, learned to code and built the app. I encourage you to check out FindMoreInternships especially you are a student. If you’re still considering whether you should learn iOS programming, I hope Vin’s story will inspire you to kick start your app development journey.

AppCoda is Three Years Old!

Today marks quite a huge milestone for us. AppCoda is 3 years old! Time flies when you’re having fun. It’s been three years since I hit the Publish button and put out the first post on AppCoda. I started AppCoda as a side project and began to publish programming tutorials on a weekly basis. It’s a lot of fun and a rewarding experience. I really enjoyed helping people learn to code. I have learned a ton about the iOS SDK while developing the tutorials. The blog has also opened up some amazing opportunities to meet great people around the world.

The last two years has been a fantastic time of change. AppCoda is no longer a one-person blog. Gabriel and Joyce joined me as our regular tutorial writers. From time to time, we have some great developers contributing tutorials and sharing their development experience. Over the past three years, we have published more than 100 detailed programming tutorials and released three books. The blog has been visited by 2,600,000 people since its launch. This is fascinating. I never imagined it would reach so many readers all over the world.

AppCoda is three years old

We would like to say a big thank you to all of you that make our business possible. It’s so gratifying to know how many of you out there reading our tutorials to learn to code and build apps. Your feedback inspires us to grow and improve our materials. We will continue to create high quality programming tutorials (of course they are free) and develop more products to help you thrive.

[Read more…]

Introduction to Custom View Controller Transitions and Animations

Looking at the built in apps from Apple on your iOS device, you will notice the various animated transitions as you move from one view to another for example the way view controllers are presented in master-detail views with a swipe that slides the detail view controller over the master view controller as seen in the Messages app or Settings app and the various transitions that represent a segue to another view controller.

iOS 7 introduced custom view controller transitions which make it possible for developers to create their own animated transitions from one view controller to the next in their apps. In this tutorial, we’ll take a look at how to do this. We’ll also look at how to create gesture driven transitions called interactive transitions. To follow along, download the starter project which we’ll be using throughout the tutorial.

custom-view-transition

[Read more…]

Developing iBeacons Apps with Swift

Since the introduction of iBeacons with iOS 7 by Apple, a lot of things have been said and written about. iBeacon technology consist of a revolutionary way to keep track of the position of a device indoors and use location services, similarly to the GPS outdoors, and it’s based on the signal transmitted through Bluetooth (Bluetooth Low Energy specifically, or BLE) by beacon devices. iOS devices can do that also, as long as they run a proper application.

However, the most important thing is that iOS SDK allows to develop applications capable of monitoring for iBeacons, and then perform various actions, depending always on specific requirements. The use of iBeacons can be applied in a wide range of cases, especially for marketing purposes. For example, using iBeacons in retail stores targeted advertisements can be displayed on the customers’ devices once the device enters a beacon’s region, or keep track of the traffic in such stores. Actually, the example that I just described is already being used, and it can be evolved even further.

ibeacons-featured-photo

From the developer’s point of view, an iBeacon area can be monitored and handled almost like a location, therefore the meaning of regions exist in this case too. The only difference is that such a region is actually called beacon region. If you’ve ever worked in the past with location services, then you already know that the Core Location framework provides API to work with regions. With this, an app can be aware of whether and when a device enters or leaves a beacon region, how to identify and manage any found beacons and a lot more. Additionally, it’s possible for an app to track changes in the bluetooth state, so it can automatically stop monitoring for beacons and save resources when the bluetooth for some reason doesn’t operate.

[Read more…]

Building Action Extensions in iOS 8

Action extensions allow users to transform content originating in a host app without leaving the app. You can, for example edit images, change the text format, change the text itself, e.t.c. At WWDC 2014, Apple showed us a demo of an Action extension that translated the text of a web page to another language without leaving Safari.

Unlike the other extensions whose usage and purpose is clear, Action extensions do not have this clear-cut usage policy. For example, you can create an Action extension that shares content to social networks or one that can perform photo edits. In the Extensibility Programming Guide, Apple caution on picking the wrong extension point. In the case of Action extension, you should make sure that it’s appropriate for what you are trying to achieve and that another extension point won’t be more suitable for your purposes. In the previous given example, it would probably be more appropriate to use the share extension and the photo editing extension respectively instead of Action extensions.

ios8-action-extensions-featured

Action extensions are made available to users only when the extension specifies that it can work with the type of content the user is currently using. For example, if the extension specifies that it only works with text, it isn’t made available when the user is viewing images.

When you create a new Action extension, Xcode creates a template which when used without changing its configurations, will appear in every single action sheet by default. It won’t perform any checking of the content types to determine whether or not it’s appropriate for the host app. If you attempt to submit it like this to the App Store review, it will be rejected – you need to specify under what circumstances your extension should appear.

You can create two types of Action extensions – one with a user interface and one without. If you chose the latter, it will be limited to Safari, but if you provide a user interface, then the extension can be made available to other apps given that the extension supports the type of content to be transformed. We’ll look at both types of Action extensions.
[Read more…]

Announcing Intermediate iOS 8 Programming with Swift

At the time of this writing, the Swift programming language and iOS 8 have been around for more than 6 months. The new programming language has gained a lot of traction and continues to evolve. It is definitely the future programming language of iOS. If you are planning to learn a programming language this year, Swift should be on the top of your list.

I love to read cookbooks. Most of them are visually appealing with pretty and delicious photos involved. That’s what gets me hook and makes me want to try out the recipes. When I started off writing this book, the very first thing that came into my mind was why most programming books were not well designed. iOS and its apps are all beautifully crafted. But why do a majority of technical books just look like an ordinary textbook?

Intermediate Swift Programming

I believe a visually stunning book will make learning programming much more effective and easy. With that in mind, I set out to make one that looks really great and is joyful to read. That being said, it doesn’t mean I just focus on the visual elements. With over 300 pages and 30 Xcode projects, the book is written for developer with some programming experience on the Swift programming language and with an interest in developing iOS apps. The tips and solutions covered in this book will help you learn more about iOS 8 programming and empower you to build fully functional apps more quickly.

[Read more…]