Xcode secrets: save time with context-sensitive help and documentation

How many times have you been looking at Swift or Objective-C code in Xcode and can’t remember what a framework method, argument, constant, etc. means? Did you know that help — full documentation — is just a keystroke away? Did you also know that you can add the same type of pop-up, context-sensitive help to your own code? Here’s how. Let’s say you’re looking at the following NSString class method and can’t remember exactly what the call does, what parameters it takes, and what is its return value:

Highlight the method name, parameter, even the enum, and then press the following key combination on your keyboard:

[command] + [control] + [shift] + [?]

      or, using key symbols:

⌘ ⌃ ⇧ ?

Here’s what you’ll see: a context-sensitive help/documentation popup. Note that I added the red lines to highlight content. The red highlighting is not what Xcode provides (click to enlarge):

Figure 1: Xcode framework context sensitive help and documentation.

So you immediately get information about the method, parameter, enum, even constant’s:

  • Declaration (formal language signature);
  • Description (textual explanation of the entity’s purpose);
  • Parameters (a full list of names and definitions);
  • Returns (the value returned by a method/function, if applicable);
  • Availability (what version of iOS that the entity became available in — and sometimes in what version it was deprecated);
  • Declared In (the framework which contains the entity); and,
  • More (generally, the formal definition of the entity with explanations and other links).

Check out what I get if I click on the “More Type Method Reference” link as shown in Figure 1 (click to enlarge):

Continue reading “Xcode secrets: save time with context-sensitive help and documentation”

Renaming an Xcode 8 project, the easy way or the advanced way

NOTE: This article was first published on Jan 18, 2017. Since that time, I realized I missed one aspect of the project renaming process. Re-read the article or jump straight to the new content.

Sometimes you need to rename your Xcode projects. Not too long ago, this would’ve been problematic. Apple has built a project renaming feature into Xcode, but it’s not good enough for my needs. I’ll show you how I have to go above and beyond the standard functionality to get what I really want. Let’s walk through a concrete example, renaming an Xcode project we’ve been talking about in the post entitled “The UICollectionView is much more than a grid or matrix”.

Continue reading “Renaming an Xcode 8 project, the easy way or the advanced way”

Basic animation, Auto Layout, and view geometry – Part 1

[Download the full Xcode project from GitHub.]

We’re going to learn about basic animation in the next few series of posts, “Basic animation, Auto Layout, and view geometry – Part X.” In order to perform animations, we need to lay the foundation for a simple app. We’ll be 1) setting up a storyboard scene using Auto Layout (this post), 2) using some basic UIView geometry to play with shapes and sizes (Part 2), and 3) writing the code in Swift and Objective-C to explore iOS animation capabilities (Part 3). After Part 3, we’ll start solidifying all the concepts you’ve learned in this series, tie all these concepts together, and come to the realization that these concepts will be indispensable in almost all your iOS development efforts. I’ll make all the source code available to y’all on GitHub as we move forward.

NOTE: The iOS skill level required herein is “beginner” to “intermediate.” One of the purposes of this blog is to help aspiring new iOS developers get started on the right foot. For all you seasoned (or “advanced”) developers out there, I encourage you to stick with this blog as we’ll be covering very complex iOS scenarios too. Everyone can benefit from these articles, including myself, by getting your feedback.

Create a new Xcode 8.x project, selecting a Single View Application, naming the project “Animation Demo,” filing out all the required new project fields, selecting “Swift” as the Language, and setting “iPhone” for Devices.

Continue reading “Basic animation, Auto Layout, and view geometry – Part 1”

Using Xcode 7 with the iOS 10 SDK

Today, we’ll be discussing getting an older version of Xcode (7) to work with a newer version of the iOS SDK (10). When done reading this article, you’ll be able to build, link, install, and debug apps in/from Xcode 7 onto iPhones/iPads/iPods running iOS 10. (If you don’t need background, just skip to the solution.) The main reasons for doing this?

  • You have an app built for the last iOS version (9) that has a problem when running in the latest iOS version (10) and you’d like to debug the code; and/or,
  • Apple releases a new beta iOS (10) and beta Xcode (8), you want to see how your current, stable code (built for iOS 9) runs on the new beta iOS (10), but you don’t want to trash your current, stable Xcode (7) installation with the beta Xcode (8).

Continue reading “Using Xcode 7 with the iOS 10 SDK”

Installing multiple versions of Xcode (6, 7, 8) side-by-side, together on the same Mac

Let’s talk about cleanly installing multiple versions of Xcode (6, 7, 8) side-by-side, together on the same Mac desktop, MacBook Pro, or MacBook Air.

Apple keeps moving forward with new Xcode and iOS versions, but some of us in the developer community need the ability to support — or just experiment with — projects in older versions. I’m currently working on an iOS 9 app, developed in Xcode 7 that’s ready to be submitted to the App Store. At this eleventh hour, the last thing I want to do is go through the pain of upgrading to a new iOS SDK in a new Xcode version. I tried building the app and its constituent libraries in Xcode 8, and was presented with tens of compiler and linker errors. Oy… But I do need to to start moving the project to Xcode 8/iOS 10 — and start other projects, check out new features, and get up to speed…

Continue reading “Installing multiple versions of Xcode (6, 7, 8) side-by-side, together on the same Mac”