---
title: "#317: Crafting Great Reverse-DNS Identifiers 🆔"
url: https://littlebitesofcocoa.com/317-crafting-great-reverse-dns-identifiers
author: Jake Marsh
date: 2017-09-19
published: 2017-09-19
topics: ["Techniques"]
description: "Apple platforms make heavy use of \"reverse-DNS\" identifiers. They appear everywhere from our Application's Identifier all the way down to the Dispatch..."
---

# #317: Crafting Great Reverse-DNS Identifiers 🆔

By Jake Marsh, September 18, 2017. HTML: https://littlebitesofcocoa.com/317-crafting-great-reverse-dns-identifiers

**Apple** platforms make heavy use of _"reverse-DNS" identifiers_.

They appear everywhere from our **Application's Identifier** all the way down to the [Dispatch Queues](https://littlebitesofcocoa.com/topics/50-concurrency?v=l) we create in our code.

These _identifiers_ are somewhat opaque in a conceptual sense, and have been around in programming for many years.

We create or set them once, and sometimes reference them in our code, but the main idea is that they're a unique, human-readable way to identify some unique <i>"thing"</i>. Their nature also offers the benefit of being unlikely to "collide" with one another.

The first thing we'll want to define is some kind of top level prefix to put on all our _identifiers_.

**Fun Fact:** [Historically](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) these _identifiers_ were <i>literally</i> reversed-DNS. That is to say, to form one in code we might take our website's domain name, reverse it, then append our app's name (for example). These days, on Apple platforms, this isn't really a "thing" anymore. Now, we're usually given a string property or text field where we can supply just about any value we want.

This means that the common TLD's on the internet are also commonly used here. A company may begin all of their _identifiers_ with `com.`, while a non-profit may start theirs with `org.`.

Next, we'll want to think of some way to group all of our identifiers, across all of our apps.

Often this is a domain-style version of our company or organization's name, or perhaps simply our own name, all lowercased, with no punctuation.

**Pro Tip:** _Identifiers_ can contain numbers, letters, hyphens (`-`), and dot (`.`) characters. Bundle IDs can have hyphens, not underscores. They're also case-sensitive. (Thanks to reader [@pointum](https://twitter.com/pointum) for the tips here!)


This gives us something like `com.littlebites.`

Great. Now we can apply this wherever we need to identify things.

<p class='break'></p>

Here are a few examples:

## Applications and Extensions

`com.littlebites.reader` - An _identifier_ for an imaginary app to read Bites. We might be tempted to just use `com.littlebites.app` or something generic, but this way we leave ourselves open to the possibility of making other apps in the future.

## In-App Purchase Identifiers

With these, we want to think about the complete set of **In-App Purchases** we plan on offering and create groups within them if possible.

`com.littlebites.reader.subscriptions.monthly`, `com.littlebites.reader.subscriptions.yearly` - Here we have an imaginary subscription plan **In-App Purchase**.

We know we want to offer other types of **In-App Purchases** in the future, so we've "grouped" all subscription purchases under a `subscriptions.` segment. Then we're able to add a shorter phrase denoting the type as the final segment.

## App Groups

**App Groups** help us share data between our apps or our app's extensions.

`group.com.littlebites.cache`, `group.com.littlebites.user` - Apple encourages to begin these with the `group.`. This way we know right away what we're dealing with. Here we've created two app groups, one to share less-important cache data (images, etc.) between apps while we keep user data in it's own group.

That's all for now, have a tip or some advice about these _identifiers_ that to share? Send it to [hello@littlebitesofcocoa.com](mailto:hello@littlebitesofcocoa.com).

<p></p>
