قالب وردپرس درنا توس
Home / IOS Development / # 317: Designing Large Reverse DNS Identifiers 🆔 – Little Bites of Cocoa

# 317: Designing Large Reverse DNS Identifiers 🆔 – Little Bites of Cocoa



Subjects

Topics

Apple platforms use heavy use of "reverse DNS" identifiers .

They appear anywhere from our Application Identifier right down to the Dispatch Queues we create in our code.

These identifiers are somewhat opaque in the conceptual sense and have been in programming for many years.

We make or put them once, and sometimes refer to them in our code, but the main idea is that they are a unique, humanly readable way to identify some unique "things" . Their nature also gives the benefits of not "colliding" with each other.

The first thing we want to define is a kind of top level prefix to put on all our identifiers . [1

9659005] Fun Fact: Historically, these identifiers were literally reverse DNS. That is, in order to form an in code, we can take our website domain name, reverse it, and then add our apps name (for example). These days, on Apple platforms, this is not a "thing" anymore. Now we are usually given a string property or a text field where we can deliver about any value we want.

This means that the regular TLD on the internet is also commonly used here. A company can begin all its identifiers with com. while a nonprofit can start their with org. .

Next, we would like to think of some way to group all of our identifiers across all of our apps.

Often this is a domain name version of company or organization name, or maybe just our own name, all lower, without punctuation.

Pro Tips: Identifiers can contain numbers, letters, hyphens ( - ) and dots (. ) characters. Hi! Bundle ID may have hyphens, not underline. They are also uppercase letters. (Thank you to the reader @ pointum for the tips here!)

This gives us something like com.littlebites.

Great.

Here are some examples:

Applications and Extensions

com.littlebites.reader – An identifier for an imaginary app to read Bites. We may be tempted to use only com.littlebites.app or something generic, but in this way we allow ourselves to open the opportunity to do other programs in the future.

Purchase Identifiers for App

] With these, we would like to think about the complete set of purchases in app we plan to offer and create groups in them if possible.

com.littlebites.reader.subscriptions.monthly com.littlebites.reader.subscriptions.yearly – Here we have an imaginary subscription plan Buy in app .

We know that we will offer other types of In-App Purchases in the future, so we have "grouped" all subscription purchases under a subscription. segment. Then we can add a shorter expression that indicates the type as the final segment.

Appgroups

Appgroups help us share data between our apps or extensions to our app.

group.com.littlebites.cache group.com.littlebites.user – Apple encourages to start these with the group. . In this way, we immediately know what we are dealing with. Here we have created two app groups, one for sharing less important cached data (images, etc.) between apps while sorting "wall-off" user data into their own group.

It's all for now, have a tip or some advice on these identifiers to share? Send it to hello@littlebitesofcocoa.com.


Source link