Creating a Custom Keyboard Using iOS 8 App Extension

Prior to iOS 8, developers could provide custom keyboards or supplement the system keyboard with custom keys within only their application. With iOS 8, Apple has made it possible to create custom keyboards that will be able to be used system wide in other apps. You can now ship a custom keyboard with your app and users will be able to choose it as the keyboard to use for every app that requires text input.

To create a successful keyboard that users are more likely to keep on using, you have to meet some of the expectations that they have for what a keyboard should do. Since they will have been using the system keyboard for a long time, it is a good place to look at when deducing what your keyboard design and functionality should be.

custom-keyboard-featured

The system keyboard is fast, responsive and capable. It doesn’t interrupt the user with requests or information. Users have come to expect the following features from their keyboard. These are not requirements for creating custom keyboards, but just examples of what you could include in your keyboard to increase the chances of it being popular in a competitive market.

  • Auto suggestion and auto correction
  • Inserting period upon double space
  • Caps lock support
  • Keycap artwork
  • Multistage input for ideographic languages
  • Appropriate layout and features based on keyboard type trait for example presenting appropriate keys for easy email input when the user switches to an email field.

[Read more...]

Creating Hello World App in Swift Using Xcode 6

The Hello World tutorial was the first programming article written for our iOS programming course. As Apple released Xcode 6, the tutorial is no longer up-to-date. We received quite a lot of emails about the tutorial update. So here you are. Instead rewriting the same tutorial in Objective-C, we’ll show you how to create the Hello World app in Swift. What’s more, we create a screencast for you.

If this is the first time you come across the tutorial, you may wonder why we teach you building a Hello World app. This programming tutorial is written for absolute beginners. We want to encourage you to learn programming. So the first app should be very simple. Despite its simplicity, the “Hello World” app serves a few purposes:

  • It gives you an overview about the syntax and structure of Swift, the new programming language of iOS.
  • It also gives you a basic introduction to the Xcode 6 environment. You’ll learn how to create a Xcode project and lay out your user interface using Storyboard. Even if you’ve used Xcode 5 before, you’ll learn what’s new in the latest version of Xcode.
  • You’ll learn how to compile a program, build the app and test it using the Simulator.
  • Lastly, it makes you think programming is not difficult. I don’t want to scare you away from learning programming. It’ll be fun.

You’ll need to use Xcode 6 (or up) to work on the Hello World project. If you haven’t upgraded to Xcode 6, just download it via this direct iTunes link.

Okay, let’s get started.
[Read more...]

Introduction to iOS 8 App Extension: Creating a Today Widget

In iOS 8, Apple introduced app extensions which let you extend functionality beyond your app and make it available to users from other parts of the system like in other apps or from the Notification Center. iOS defines different types of extensions, each tied to an area of the system such as the keyboard, Notification Center, e.t.c. A system area that supports extensions is called an extension point. Below is a list of the extension points in iOS.

  • Today – Shows brief information and can allow performing of quick tasks in the Today view of Notification Center
  • Share – Share content with others or post to a sharing website
  • Action – Manipulate content in a host app
  • Photo Editing – Edit photos or videos within the Photos app
  • Document Provider – Provide access to and manage a repository of files
  • Custom Keyboard – Provide a custom keyboard to replace the iOS system keyboard

app-extension-today-featured

We will cover all these extension points in this and subsequent tutorials. With this article, we will focus on the Today Extension.
[Read more...]

How to Beta Test Your App Using TestFlight

Suppose you built an app and completed the testing of your app on a real device. So what’s next? Submit your app directly to App Store and make it available for download? Yes, you can if your app is a simple one. However, if you’re developing a high quality app, don’t rush to get your app out. I suggest you beta test the app before the actual release.

A beta test is a step in the cycle of a software product release. I know you’ve tested your app using the built-in simulator and on your own device. Interestingly, you may not be able to uncover some of the bugs, even though you’re the app creator. By going through beta test, you would be amazed at the number of flaws discovered at this stage. Beta testing is generally opened to a select number of users. They may be your potential app users, your blog followers, your colleagues, friends or even family members. The whole point of beta testing is to let a small group of real people get their hands on your app, test it and provide feedback. You want your beta tester to discover as many bugs as possible in this stage so that you can fix them before rolling out your app to the public.

You may be wondering how can you conduct a beta test for your app, how beta testers run your app before it’s available on App Store and how testers report bugs?

testflight-featured

In iOS 8, Apple released a new tool called TestFlight to streamline the beta testing. You may have heard of TestFlight before. It has been around for several years as an independent mobile platform for mobile app testing. In February 2014, Apple acquired TestFlight’s parent company, Burstly. With the official release of Xcode 6 and iOS 8, TestFlight is now integrated into iTunes Connect that allows you to invite beta testers using just their email addresses.

TestFlight allows you to arrange testing with external testers and internal users. Conceptually, both can be your testers at the beta testing stage. However, TestFlight refers internal users as members of your development team who have been assigned the Technical or Admin role in iTunes Connect. You’re allowed to invite up to 25 internal users to test your app. An external tester, on the other hand, is considered as an user outside your team and company. You can invite up to 1,000 users to beta test your app. There is a catch, though. Your app must be approved by Apple before you can invite your external testers for testing. This restriction doesn’t apply to internal users. Your internal users can begin beta testing once you upload your app to iTunes Connect.

In this tutorial, I will walk you through the beta test process using TestFlight. At the time of this writing, you can only arrange beta test for internal users only. So we will focus on beta testing with internal users. In general, you need to go through the below tasks to distribute an app for beta testing:

  • Create an app record on iTunes Connect.
  • Update the build string.
  • Archive and upload your app.
  • Manage beta testing in iTunes Connect.

Let’s get started.
[Read more...]

Announcing Our New Book: Beginning iOS 8 Programming with Swift

I’m thrilled to share this great news with you. Our second AppCoda book – Beginning iOS 8 Programming with Swift is now live and ready for purchases!

During the WWDC 2014, Apple surprised every iOS developer by launching a new programming language called Swift. I didn’t expect a new programming language to come out this year. I was expecting to see new APIs for iOS 8 along with a newer version of Xcode. This really surprised me and my friends too. I remember what one of my friends said to me. He told me, “You will have to rewrite your whole book again!”

Seriously. That’s a lot of work. So here comes the new book.

The first AppCoda book was basically an assortment of tutorials, which were published in this blog. It covered everything from the fundamental of Objective-C programming to more advance ones, where each programming technique was accompanied by a fully working app. I am really grateful that the practical approach has gained very positive feedback.

Beginning iOS 8 Programming with Swift

[Read more...]

Building an RSS Reader Using UISplitViewController and UIPopoverViewController

Just a few weeks ago Apple introduced the new iPhone devices, the iPhone 6 and iPhone 6 Plus. As we all saw, the screen sizes are bigger than all the older iPhone screens, meaning that any new applications must be build in that way so they work on all devices. Even more, if we consider the iPad screens, then the number of screen sizes that any application should adapt to becomes even greater. From a first point of view, that may seem a big hassle for developers, however that’s not true at all.

In iOS 8, Apple introduces the so-called adaptive user interface or adaptive layout. With that new philosophy, application interfaces can be adjusted and configured pretty fast for any kind of display. With adaptive UI, some existing concepts have become deprecated, such as various delegate methods regarding the device orientation. On the other hand, new concepts are provided for easier and more general handling of the interface, and developers just need to get used to working with them. Anyway, in this tutorial I’m not going to discuss in depth about the adaptive UI, but as we are going to be in align with it, there are a few things that we will see in a bit more detail later on.

splitviewcontroller-featured

Further than all the above, it’s well known that iOS 8 not only contains new features, but great improvements to existing ones as well. Of course, view controllers could not just stay out of those improvements, and that’s more or less what we are going to talk about. Specifically, we are going to focus on two special view controllers, the UISplitViewController and the UIPopoverViewController.
[Read more...]

Working with Touch ID API in iOS 8 SDK

With every major version release of iOS, Apple ships along a great number of new technologies and frameworks. iOS 8 is going to be released officially pretty soon, and new great stuff awaits both users and developers. This version of iOS brings quite exciting new things, and among them, don’t forget the new programming language named Swift, that Apple presented at the WWDC this summer. So, with this tutorial I would like to welcome you to a series of new posts, in which we are going to work with frameworks introduced in iOS 8, and with improvements made to the existing SDK.

Starting from this tutorial, we are going to develop all the sample applications for the next ones in Swift. Not because it’s a brand new language and it would be cool to get to know it, but mostly because it’s quite possible to become the official language of iOS (and Mac OS) after a while. We have been working with Objective-C for some time, some of us for years, and of course, we don’t mean to forget it. However, as technology evolves, it’s our duty to learn this new language.

touch-id-api

Before I start talking about the topic of this tutorial, I would like to make a few observations regarding Swift, since this is the first time I write about it. I am pretty sure that all of you that you are now reading these lines, you have seen the related WWDC session videos, you have downloaded the e-book, and you’ve read a few (or more) things about Swift. Compared to Objective-C, Swift is much simpler from the point of syntax, the code is much clearer and of course, thanks to the nature of Swift, safer. Furthermore, one could say that reminds a combination of other languages. Even though it’s necessary to get used to a new way of writing code and to forget old habits (such as adding the semicolon ; at the end of each command), there are only a few new things you have to learn in Swift (such as optionals, tuples, new way to handle structures, etc.). If it has been easy for you to develop applications in Objective-C, then it’s really easy to write code in Swift too, and you will find this out through this tutorial. Closing this short talk about Swift, I must say that since this language is new, I recommend you to keep the e-book always open for study, and of course… to read the tutorials at Appcoda!
[Read more...]

Understanding Self Sizing Cells and Dynamic Type in iOS 8

In iOS 8, Apple introduces a new feature for UITableView known as Self Sizing Cells. To me, this is seriously one of the most exciting features for the new SDK. Prior to iOS 8, if you want to display dynamic content in table view with variable height, you would need to calculate the row height manually. Now with iOS 8, Self Sizing Cell provides a solution for displaying dynamic content. In brief, here are what you need to do when using self sizing cells:

  • Define auto layout constraints for your prototype cell
  • Specify the estimatedRowHeight of your table view
  • Set the rowHeight of your table view to UITableViewAutomaticDimension

If we express the last two points in code, it looks like this:

1
2
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension

With just two lines of code, you instruct the table view to calculate the cell’s size matching its content and render it dynamically. This self sizing cell feature should save you tons of code and time. You’re gonna love it.

self-sizing-cell-featured
[Read more...]

Using Gesture Recognizers to Handle Pinch, Rotate, Pan, Swipe and Tap Gestures

Hello readers! iOS 8 is at the gates, as only a few weeks remain until the official release of the updated version of the operating system, and along with it, the release of the Swift programming language. So, as you understand, we are preparing to enter into a new era of the iOS SDK, where new wonderful technologies waiting for us to explore them! However, here at Appcoda we decided to dedicate one more tutorial to the existing SDK, using the Objective-C language. My next tutorials will focus on new iOS 8 technologies, and we’ll use the Swift language. Regarding this one, there were many candidate topics to write for, but ultimately the chosen one is about the Gesture Recognizers. So, let’s see a few things about them.

A gesture recognizer is actually an object of the abstract class UIGestureRecognizer. Such an object is related to a view, and monitors for predefined gestures made on that view. Going one level deeper, I would say that gestures are actually touches and movements of one or more fingers that happen on a specific area of the screen, where a view of interest exists there. In the early versions of iOS SDK, gestures recognizers were not provided to developers, so implementing such ways of interaction required a lot of manual work. Thankfully, Apple wrapped up all that manual work and gave it to developers as a single tool, and that way working with gestures became a really easy part of the iOS programming.

gestures-featured

[Read more...]

Introduction to UIAlertController, Swift Closures and Enumeration

Among all the changes in iOS 8 SDK, the changes of two commonly-used APIs in UIKit framework are less known. Both UIActionSheet and UIAlertView classes are now replaced by the UIAlertController class.

In iOS 8, whenever you want to display an alert message in your app, you should use UIAlertController instead the two deprecated classes. The action sheet and alert view become the style of the UIAlertController. You choose one of the styles when creating an alert controller. The way to handle button action is redesigned. You no longer use delegate (e.g. UIAlertViewDelegate) to handle user response. When using UIAlertController, you associate actions with the controller and that the action is expressed as a block in Objective-C or closures in Swift.

In this tutorial, I’ll give you an introduction to the UIAlertController and cover how to use the class to present an alert message, as well as, an action sheet. On top of that, I’ll take this opportunity to cover the basics of closures and enumeration in Swift.

UIAlertController Introduction

Okay, let’s get started.
[Read more...]