# NSHipster > NSHipster is a journal of the overlooked bits in Objective-C, Swift, and Cocoa. NSHipster has published articles about Apple platform development since 2012. Articles cover Swift and Objective-C language features, Foundation and Cocoa APIs, Xcode, and developer tools. Some older articles describe APIs that Apple has since deprecated or replaced; each article gives its publication and revision dates. Each article has a Markdown version at its URL with `.md` appended, such as https://nshipster.com/nscache.md for https://nshipster.com/nscache. The links below go to these Markdown versions. NSHipster articles are released under the Creative Commons Attribution-NonCommercial 4.0 License (https://creativecommons.org/licenses/by-nc/4.0/), which permits sharing and adapting them for non-commercial purposes with attribution. ## Cocoa - [AVSpeechSynthesizer](https://nshipster.com/avspeechsynthesizer.md): Though we’re a long way off from Hal or Her, we shouldn’t forget about the billions of people out there for us to talk to. - [Apple Push Notification Device Tokens](https://nshipster.com/apns-device-tokens.md): Precedent plays an important role throughout software engineering. So what does a change in iOS 13 to push notification registration have to say about Apple’s API design decisions? - [Bundles and Packages](https://nshipster.com/bundles-and-packages.md): In this season of giving, let’s stop to consider one of the greatest gifts given to us by modern computer systems: the gift of abstraction. - [CAEmitterLayer](https://nshipster.com/caemitterlayer.md): This week marks NSHipster’s 7th anniversary! And what better way to celebrate the occasion than to implement a fun and flexible confetti view on iOS? - [CFBag](https://nshipster.com/cfbag.md): In the pantheon of collection data types in computer science, bag doesn’t really have the same clout as lists, sets, associative arrays, trees, graphs, or priority queues. In fact, it’s pretty obscure. You’ve probably never heard of it. - [CFStringTransform](https://nshipster.com/cfstringtransform.md): NSString is the crown jewel of Foundation. But as powerful as it is, one would be remiss not to mention its toll-free bridged cousin, CFMutableString—or more specifically, CFStringTransform. - [CMDeviceMotion](https://nshipster.com/cmdevicemotion.md): Beneath the smooth glass of each iPhone an array of sensors sits nestled on the logic board, sending a steady stream of data to a motion coprocessor. - [CMMotionActivity](https://nshipster.com/cmmotionactivity.md): Today’s iPhones are packed with a full complement of sensors that includes cameras, barometers, gyroscopes, magnetometers, and accelerometers. Like humans, they use permutations of different sensory information to make determinations about their position and orientation, often by means quite similar to our own biomechanical processes. - [CharacterSet](https://nshipster.com/characterset.md): CharacterSet isn’t a set and it doesn’t contain Character values. Before we use it to trim, filter, and search through text, we should take a closer look to see what’s actually going on. - [CloudKit](https://nshipster.com/cloudkit.md): As an iOS developer, if you want to make an application on your own, you sometimes need to write back-end code. Even for the developer who can take that on, there is more than just the code, there’s also maintenance. Your worst fear becomes not that people might not like your application, but that your server might fail under heavy traffic. Fortunately, we now have CloudKit. Apple takes care of all these details, so you can focus on how to make your application great. - [Core Location in iOS 8](https://nshipster.com/core-location-in-ios-8.md): For as long as the iPhone has existed, location services have been front and center. iOS 8 brings three major sets of changes to the Core Location framework: more granular permissions, indoor positioning, and visit monitoring. - [CoreGraphics Geometry Primitives](https://nshipster.com/cggeometry.md): Unless you were a Math Geek or an Ancient Greek, Geometry probably wasn’t your favorite subject in school. More likely, you were that kid in class who dutifully programmed all of those necessary formulæ into your TI-8X calculator to avoid rote memorization. - [DateComponents](https://nshipster.com/datecomponents.md): DateComponents is a useful, but ambiguous type. Taken in one context, date components can be used to represent a specific calendar date. But in another context, the same object might instead be used as a duration of time. - [Dictionary Services](https://nshipster.com/dictionary-services.md): Though widely usurped of their ‘go-to reference’ status by the Internet, dictionaries and word lists serve an important role behind the scenes for features ranging from spell check, grammar check, and auto-correct to auto-summarization and semantic analysis. - [FileManager](https://nshipster.com/filemanager.md): FileManager offers a convenient way to create, read, move, copy, and delete both files and directories, whether they’re on local or networked drives or iCloud ubiquitous containers. - [Formatter](https://nshipster.com/formatter.md): Conversion is a tireless errand in software development. Most programs boil down to some variation of transforming data into something more useful. - [Guided Access](https://nshipster.com/guided-access.md): Improve your analog device interactions with this one weird accessibility trick. - [IBAction / IBOutlet / IBOutletCollection](https://nshipster.com/ibaction-iboutlet-iboutletcollection.md): In programming, what often begins as a necessary instruction eventually becomes a vestigial cue for humans. For developers just starting with Cocoa & Cocoa Touch, the IBAction, IBOutlet, and IBOutletCollection macros are particularly bewildering examples of this phenomenon - [JavaScriptCore](https://nshipster.com/javascriptcore.md): Whether you love it or hate it, JavaScript has become the most important language for developers today. Despite any efforts we may take to change or replace it we’d be hard-pressed to deny its usefulness. - [KVC Collection Operators](https://nshipster.com/kvc-collection-operators.md): Rubyists laugh at Objective-C’s bloated syntax. Although we lost a few pounds over the summer with our sleek new object literals, those Red-headed bullies still taunt us with their map one-liners and their fancy Symbol#to_proc. Fortunately, Key-Value Coding has an ace up its sleeve. - [Key-Value Observing](https://nshipster.com/key-value-observing.md): Ask anyone who’s been around the NSBlock a few times: Key-Value Observing has the worst API in all of Cocoa. It’s awkward, verbose, and confusing. And worst of all, its terrible API belies one of the most compelling features of the framework. - [Locale](https://nshipster.com/locale.md): The hardest thing about internationalization (aside from saying the word itself) is learning how to think outside of your cultural context. Unless you’ve had the privilege to travel or to meet people from other places, you may not even be aware that things could be any other way. - [LocalizedError, RecoverableError, CustomNSError](https://nshipster.com/swift-foundation-error-protocols.md): We’re all familiar with the Error type, but have you met these related Swift Foundation error protocols? - [MKGeodesicPolyline](https://nshipster.com/mkgeodesicpolyline.md): We knew that the Earth was not flat long before 1492. Early navigators observed the way ships would dip out of view over the horizon many centuries before the Age of Discovery. For many iOS developers, though, a flat MKMapView was a necessary conceit until recently. - [MKLocalSearch](https://nshipster.com/mklocalsearch.md): In all of the hubbub of torch burning and pitchfork raising, you may have completely missed a slew of additions to MapKit in iOS 6.1. - [MKTileOverlay, MKMapSnapshotter & MKDirections](https://nshipster.com/mktileoverlay-mkmapsnapshotter-mkdirections.md): Unless you work with MKMapView on a regular basis, the last you may have heard about the current state of cartography on iOS may not have been under the cheeriest of circumstances. Therefore, it may come as a surprise that maps on iOS have gotten quite a bit better in the intervening releases. Quite good, in fact. - [NLLanguageRecognizer](https://nshipster.com/nllanguagerecognizer.md): Machine learning has been at the heart of natural language processing in Apple platforms for many years, but it’s only recently that external developers have been able to harness it directly. - [NSAssertionHandler](https://nshipster.com/nsassertionhandler.md): Programming incorporates numerous disciplines of human reasoning, from high-level discourse and semantics—the story we tell each other to explain how a system works—to the mathematical and philosophical machinery that underpins everything. - [NSCache](https://nshipster.com/nscache.md): Poor NSCache, always being overshadowed by NSMutableDictionary. It’s as if no one knew how it provides all of that garbage collection behavior that developers take great pains to re-implement themselves. - [NSCalendar Additions](https://nshipster.com/nscalendar-additions.md): NSCalendar has been quietly building a powerful set of methods for accessing and manipulating dates. From new ways of accessing individual date components and flexibly comparing dates to powerful date interpolation and enumeration methods, there’s far too much to ignore. Make some room in your calendar and read on for more. - [NSCoding / NSKeyedArchiver](https://nshipster.com/nscoding.md): Among the most important architectural decisions made when building an app is how to persist data between launches. The question of how, exactly, to re-create the state of the app from the time it was last opened; of how to describe the object graph in such a way that it can be flawlessly reconstructed next time. - [NSDataAsset](https://nshipster.com/nsdataasset.md): There are many ways to speed up a network request: compressing and streaming, caching and prefetching, reducing and inlining, connection pooling and multiplexing, deferring and backgrounding. And yet there’s one optimization strategy that both predates and outperforms them all: not making the request in the first place. - [NSDataDetector](https://nshipster.com/nsdatadetector.md): Until humanity embraces RDF for our daily interactions, computers will have to work overtime to figure out what the heck we’re all talking about. - [NSError](https://nshipster.com/nserror.md): NSError is the unsung hero of the Foundation framework. Passed gallantly in and out of perilous method calls, it is the messenger by which we are able to contextualize our failures. - [NSExpression](https://nshipster.com/nsexpression.md): Cocoa is the envy of other standard libraries when it comes to querying and arranging information. With NSPredicate, NSSortDescriptor, and an occasional NSFetchRequest, even the most complex data tasks can be reduced into just a few, extremely-understandable lines of code. - [NSFastEnumeration / NSEnumerator](https://nshipster.com/enumerators.md): Enumeration is where computation gets interesting. It’s one thing to encode logic that’s executed once, but applying it across a collection—that’s what makes programming so powerful. - [NSHashTable & NSMapTable](https://nshipster.com/nshashtable-and-nsmaptable.md): NSSet and NSDictionary, along with NSArray are the workhorse collection classes of Foundation. Unlike other standard libraries, implementation details are hidden from developers, allowing them to write simple code and trust that it will be (reasonably) performant. - [NSIndexSet](https://nshipster.com/nsindexset.md): NSIndexSet (like its mutable counterpart, NSMutableIndexSet) is a sorted collection of unique unsigned integers. Think of it like an NSRange that supports non-contiguous series. It has wicked fast operations for finding indexes in ranges or set intersections, and comes with all of the convenience methods you’d expect in a Foundation collection class. - [NSLocalizedString](https://nshipster.com/nslocalizedstring.md): Strings are perhaps the most versatile data type in computing. They’re passed around as symbols, used to encode numeric values, associate values to keys, represent resource paths, store linguistic content, and format information. Having a strong handle on user-facing strings is essential to making a great user experience. - [NSNotification & NSNotificationCenter](https://nshipster.com/nsnotification-and-nsnotificationcenter.md): Any idea is inextricably linked to how it’s communicated. A medium defines the form and scale of significance in such a way to shape the very meaning of an idea. Very truly, the medium is the message. - [NSOperation](https://nshipster.com/nsoperation.md): In life, there’s always work to be done. Every day brings with it a steady stream of tasks and chores to fill the working hours of our existence. Productivity is, as in life as it is in programming, a matter of scheduling and prioritizing and multi-tasking work in order to keep up appearances. - [NSOrderedSet](https://nshipster.com/nsorderedset.md): Why isn’t NSOrderedSet a subclass of NSSet? The answer may surprise you. - [NSPredicate](https://nshipster.com/nspredicate.md): NSPredicate is a Foundation class that specifies how data should be fetched or filtered. Its query language, which is like a cross between a SQL WHERE clause and a regular expression, provides an expressive, natural language interface to define logical conditions on which a collection is searched. - [NSRange](https://nshipster.com/nsrange.md): NSRange is one of the essential types of Foundation. Passed around and returned in methods throughout the framework, being well-versed in this struct has a range of benefits. - [NSScanner](https://nshipster.com/nsscanner.md): Being able to pull apart strings and extract particular bits of data is a powerful skill, one that we use over and over building apps and shaping our tools. Cocoa provides a powerful set of frameworks to handle string processing. This week’s article focuses on NSScanner, a highly configurable tool designed for extracting substrings and numeric values from loosely demarcated strings. - [NSSecureCoding](https://nshipster.com/nssecurecoding.md): A short post for this week: everything you need to know about NSSecureCoding. - [NSSortDescriptor](https://nshipster.com/nssortdescriptor.md): Sorting: it’s the mainstay of Computer Science 101 exams and whiteboarding interview questions. But when was the last time you actually needed to know how to implement Quicksort yourself? - [NSURL / NSURLComponents](https://nshipster.com/nsurl.md): Of all the one-dimensional data types out there, URIs reign supreme. Here, in a single, human-parsable string, is every conceivable piece of information necessary to encode the location of any piece of information that has, does, and will ever exist on a computer. - [NSURLCache](https://nshipster.com/nsurlcache.md): NSURLCache provides a composite in-memory and on-disk caching mechanism for URL requests to your application. As part of Foundation’s URL Loading System, any request loaded through NSURLConnection will be handled by NSURLCache. - [NSURLProtocol](https://nshipster.com/nsurlprotocol.md): Foundation’s URL Loading System is something that every iOS developer would do well to buddy up with. And of all of the networking classes and protocols of Foundation, NSURLProtocol is perhaps the most obscure and powerful. - [NSUndoManager](https://nshipster.com/nsundomanager.md): We all make mistakes. Thankfully, Foundation comes to our rescue for more than just our misspellings. Cocoa includes a simple yet robust API for undoing or redoing actions through NSUndoManager. - [NSValue](https://nshipster.com/nsvalue.md): Boxing is the process of encapsulating scalars and value types with an object container, and is primarily used to store those values in collection objects—namely arrays and dictionaries. In Foundation, the reigning featherweight champion of boxing is NSValue. - [NS\_ENUM & NS\_OPTIONS](https://nshipster.com/ns_enum-ns_options.md): A skilled Objective-C developer is able to gracefully switch between Objective and Procedural paradigms, and use each to their own advantage. - [Password Rules / UITextInputPasswordRules](https://nshipster.com/uitextinputpasswordrules.md): Unless it’s the title of a hacker movie from the 90’s or the solution to an escape room puzzle, a password should be utterly devoid of meaning. - [Search Kit](https://nshipster.com/search-kit.md): Search Kit is a C framework for searching and indexing content in human languages. It supports matching on phrase or partial word, including logical & wildcard operators, and can rank results by relevance. Search Kit also provides document summarization, which is useful for generating representative excerpts. And best of all: it’s thread-safe. - [Temporary Files](https://nshipster.com/temporary-files.md): Volumes have been written about persisting data, but when it comes to short-lived, temporary files, there is very little to go on for Cocoa. (Or if there has, perhaps it was poetically ephemeral itself). - [TimeInterval, Date, and DateInterval](https://nshipster.com/timeinterval-date-dateinterval.md): Our limited understanding of time is reflected in — or perhaps exacerbated by — the naming of the Foundation date and time APIs. It’s about time we got them straight. - [UIAccessibility](https://nshipster.com/uiaccessibility.md): Accessibility, like internationalization, is one of those topics that’s difficult to get developers excited about. But as you know, NSHipster is all about getting developers excited about this kind of stuff. - [UIActivityViewController](https://nshipster.com/uiactivityviewcontroller.md): iOS provides a unified interface for users to share and perform actions on strings, images, URLs, and other items within an app. - [UIAlertController](https://nshipster.com/uialertcontroller.md): Did you know that UIAlertView and UIActionSheet (as well as their respective delegate protocols) are deprecated in iOS 8? It’s true. - [UIAppearance](https://nshipster.com/uiappearance.md): UIAppearance allows the appearance of views and controls to be consistently defined across the entire application. - [UIApplicationDelegate launchOptions](https://nshipster.com/launch-options.md): AppDelegate is the dumping ground for functionality in iOS. - [UICollectionView](https://nshipster.com/uicollectionview.md): UICollectionView single-handedly changes the way we will design and develop iOS apps from here on out. This is not to say that collection views are in any way unknown or obscure. But being an NSHipster isn’t just about knowing obscure gems in the rough. Sometimes, it’s about knowing about up-and-comers before they become popular and sell out. - [UIFieldBehavior](https://nshipster.com/uifieldbehavior.md): With the design refresh of iOS in its 7th release, skeuomorphic design was famously sunset. In its place, a new paradigm emerged, in which UI controls were made to feel like physical objects rather than simply look like them. - [UIKeyCommand](https://nshipster.com/uikeycommand.md): As part of the push for greater productivity on the iPad, iOS 9 adds Discoverability, an overlay showing the currently available key commands inside an app. This small change suddenly makes key commands far more viable on the iPad and, with it, makes UIKeyCommand a necessary addition to your app. - [UILocalizedIndexedCollation](https://nshipster.com/uilocalizedindexedcollation.md): UITableView starts to become unwieldy once it gets to a few hundred rows. If users are reduced to frantically scratching at the screen like a cat playing Fruit Ninja in order to get at what they want… you may want to rethink your UI approach. - [UIPrintInteractionController](https://nshipster.com/uiprintinteractioncontroller.md): With all the different means to comment, mark up, save, and share right at our fingertips, it’s easy to overlook the value of a printed sheet of paper. - [UISplitViewController](https://nshipster.com/uisplitviewcontroller.md): Although user interface idioms have made way for the broader concept of size classes, UISplitViewController remains a workhorse API for writing Universal apps. - [UIStackView](https://nshipster.com/uistackview.md): Many of us reserve stack views for only the most mundane layouts in iOS. But learn of their myriad capabilities, and you’ll come to scoff at the idea of fiddling with Auto Layout constraints yourself ever again. - [UITableViewHeaderFooterView](https://nshipster.com/uitableviewheaderfooterview.md): Sure, everyone knows that they can (and should!) reuse table view cells. But did you know that you can do the same for section headers and footers? - [UITextChecker](https://nshipster.com/uitextchecker.md): Make no mistake, a tiny keyboard on a slab of glass doesn’t always lend itself to perfect typing. Whether for accuracy or hilarity, anyone typing on an iOS device notices when autocorrect steps in to help out. You might not know, however, that UIKit includes a class to help you with your user’s typing inside your app. - [ValueTransformer](https://nshipster.com/valuetransformer.md): ValueTransformer is perhaps the one that fared the worst in the shift from macOS to iOS. But you know what? It’s ripe for a comeback. With a little bit of re-tooling and some recontextualization, this blast from the past could be the next big thing in your application. - [WKWebView](https://nshipster.com/wkwebview.md): iOS has a complicated relationship with the web. And it goes back to the very inception of the platform over a decade ago. ## Swift - [@isolated(any)](https://nshipster.com/isolated-any.md): There are cases where just a little more visibility and control over how to schedule asynchronous work can make all the difference. - [API Pollution in Swift Modules](https://nshipster.com/swift-api-pollution.md): When you import a module into Swift code, you expect the result to be entirely additive. But as we’ll see, this isn’t always the case. - [CustomPlaygroundDisplayConvertible](https://nshipster.com/customplaygrounddisplayconvertible.md): Playgrounds use a combination of language features and tooling to provide a real-time, interactive development environment. With the CustomPlaygroundDisplayConvertible protocol, you can leverage this introspection for your own types. - [Equatable and Comparable](https://nshipster.com/equatable-and-comparable.md): Objective-C required us to wax philosophic about the nature of equality and identity. To the relief of any developer less inclined towards discursive treatises, this is not as much the case for Swift. - [ExpressibleByStringInterpolation](https://nshipster.com/expressiblebystringinterpolation.md): Swift 5 overhauls how values in string literals are interpolated, and incidentally overturns several decades’ worth of problematic programming conventions. - [Hashable / Hasher](https://nshipster.com/hashable.md): Our topic this week is Hashable and its new related type, Hasher. Together, they comprise the functionality underlying two of Swift’s most beloved collection types: Dictionary and Set. - [Identifiable](https://nshipster.com/identifiable.md): Swift 5.1 gives us yet another occasion to ponder ontological questions and weigh the relative merits of various built-in types as stable identifiers. - [KeyValuePairs](https://nshipster.com/keyvaluepairs.md): A look at an obscure, little collection type that challenges our fundamental distinctions between Array, Set, and Dictionary. - [Mirror / CustomReflectable / CustomLeafReflectable](https://nshipster.com/mirror.md): Reflection in Swift is a limited affair, providing read-only access to information about objects. In fact, this functionality might be better described as introspection rather than reflection. But can you really blame them for going with that terminology? - [Never](https://nshipster.com/never.md): Making a claim that something will never be the case can feel like an invitation for the universe to prove otherwise. Fortunately for us, Swift lives up to this higher standard thanks to the unlikeliest of types. - [OptionSet](https://nshipster.com/optionset.md): Objective-C uses the NS_OPTIONS macro to define sets of values that may be combined together. Swift imports those types as structures conforming to the OptionSet protocol. But could new language features in Swift provide a better option? - [Optional, throws, Result, async/await](https://nshipster.com/optional-throws-result-async-await.md): An exploration of error handling in Swift: then, now, and soon. - [RawRepresentable](https://nshipster.com/rawrepresentable.md): Programming is about typing. And programming languages are typically judged by how much they make you type — in both senses of the word. - [Regular Expressions in Swift](https://nshipster.com/swift-regular-expressions.md): Regular expressions are a powerful tool for working with text, but it’s often a mystery how to use them in Swift. - [Static and Dynamic Callable Types in Swift](https://nshipster.com/callable.md): If like most of us, you aren’t tuned into the comings-and-goings of Swift Evolution, Xcode 11.4 is your first exposure to two new additions to the language: key path expressions as functions and callable values of user-defined nominal types. - [Swift & the Objective-C Runtime](https://nshipster.com/swift-objc-runtime.md): Even when written without a single line of Objective-C code, every Swift app executes inside the Objective-C runtime, opening up a world of dynamic dispatch and associated runtime manipulation. To be sure, this may not always be the case—Swift-only frameworks, whenever they come, may lead to a Swift-only runtime. But as long as the Objective-C runtime is with us, let’s use it to its fullest potential. - [Swift API Availability](https://nshipster.com/available.md): Code exists in a world of infinite abundance. Whatever you can imagine is willed into being… for the most part. Because despite the boundless potential afforded to us, we often find ourselves constrained by circumstances beyond us. - [Swift Code Formatters](https://nshipster.com/swift-format.md): Lately, the Swift community has been buzzing about the latest pitch to adopt an official style guide and formatting tool for the language. Let’s take a look at where we’re at today, how the proposed swift-format tool stacks up, and what we might expect in the future. - [Swift Documentation](https://nshipster.com/swift-documentation.md): Code structure and organization is a matter of pride for developers. Clear and consistent code signifies clear and consistent thought. - [Swift GYB](https://nshipster.com/swift-gyb.md): Not all code can be glamorous. In fact, a lot of the low-level infrastructure that makes everything work is a slog of boilerplate. - [Swift Import Declarations](https://nshipster.com/import.md): One of the first lessons we learn as software developers is how to organize concepts and functionality into discrete units. But what happens when namespaces collide and declarations lurk in the shadows? - [Swift Literals](https://nshipster.com/swift-literals.md): Literals are representations of values in source code. The different kinds of literals that Swift provides — and how it makes them available — has a profound impact on how we write and think about code. - [Swift Logging](https://nshipster.com/swift-log.md): Developed by the Swift on Server community, its benefit isn’t limited to use on the server. Indeed, any Swift code intended to be run from the command line would benefit from adopting SwiftLog. - [Swift Operators](https://nshipster.com/swift-operators.md): Operators are what do the work of a program. They are the very execution of an executable; the teleological driver of every process. - [Swift Property Observers](https://nshipster.com/swift-property-observers.md): Modern software development has become what might be seen as the quintessence of Goldbergian contraption. Yet there are occasions when action-at-a-distance may do more to clarify rather than confound. - [Swift Property Wrappers](https://nshipster.com/propertywrapper.md): Swift property wrappers go a long way to making SwiftUI possible, but they may play an even more important role in shaping the future of the language as a whole. - [SwiftSyntax](https://nshipster.com/swiftsyntax.md): SwiftSyntax is a Swift library that lets you parse, analyze, generate, and transform Swift source code. Let’s see how you can use it to build a code formatter and syntax highlighter. - [TextOutputStream](https://nshipster.com/textoutputstream.md): print is among the most-used functions in the Swift standard library. Indeed, it’s the first function a programmer learns when writing “Hello, world!”. So it’s surprising how few of us are familiar with its other forms. - [Unmanaged](https://nshipster.com/unmanaged.md): A reading of Swift’s standard library shows a clear demarcation between the safety and reliability that Swift advertises on one side and the tools necessary for Objective-C interoperability on the other. Types with names like Int, String, and Array let you expect straightforward usage and unsurprising behavior, while it’s impossible to create an UnsafeMutablePointer or Unmanaged instance without thinking “here be dragons.” - [Void](https://nshipster.com/void.md): Void has no members: no methods, no values, not even a name. It’s a something more nothing than nil. - [guard & defer](https://nshipster.com/guard-and-defer.md): Swift 2.0 introduced two new control statements that aimed to simplify and streamline the programs we write. While the former by its nature makes our code more linear, the latter does the opposite by delaying execution of its contents. - [numericCast(\_:)](https://nshipster.com/numericcast.md): Getting code to compile is different than doing things correctly. But sometimes it takes the former to ultimately get to the latter. ## Xcode - [Launch Arguments & Environment Variables](https://nshipster.com/launch-arguments-and-environment-variables.md): There are a number of options that can be passed into a target’s scheme to enable useful debugging behavior, but like a fast food secret menu, they’re obscure and widely unknown. - [MetricKit](https://nshipster.com/metrickit.md): At WWDC this year, Apple announced a coordinated effort between Xcode 11 and iOS 13 to bring new insights to developers about how their apps are performing in the field. - [Network Link Conditioner](https://nshipster.com/network-link-conditioner.md): App developers often forget to test how their apps perform under less-than-ideal networking environments. Learn how you can use the Network Link conditioner to simulate a spotty Internet connection on your device. - [Quick Look Debugging](https://nshipster.com/quick-look-debugging.md): Debugging can be an exercise in irony. We create programs that tell our pint-sized supercomputers to complete infinitely varied and incalculable tasks on our behalf, yet when trying to understand those same programs, we tell the computers to wait for us. - [SwiftUI Previews on macOS Catalina and Xcode 11](https://nshipster.com/swiftui-previews.md): Working on a large iOS codebase often involves a lot of waiting. But with Xcode 11, our wait is finally over — and it’s all thanks to SwiftUI. - [XCTestCase / XCTestExpectation / measureBlock()](https://nshipster.com/xctestcase.md): This week, we’ll take a look at XCTest, the testing framework built into Xcode, as well as the exciting new additions in Xcode 6: XCTestExpectation and performance tests. - [Xcode Build Configuration Files](https://nshipster.com/xcconfig.md): Software development best practices prescribe strict separation of configuration from code. Learn how you can use xcconfig files to make your Xcode projects more compact, comprehensible, and powerful. - [Xcode Key Bindings & Gestures](https://nshipster.com/xcode-key-bindings-and-gestures.md): Xcode key bindings and gestures not only shave off seconds of precious work, but make you look more confident, competent, and cromulent in the process. - [Xcode Snippets](https://nshipster.com/xcode-snippets.md): iOS development all but requires the use of Xcode. And if we’re resigned to use an IDE in our development workflow, we might as well make the most of it, right? So this week on NSHipster, we’re going to talk about one of the more powerful yet underused features of Xcode: Code Snippets - [XcodeKit and Xcode Source Editor Extensions](https://nshipster.com/xcode-source-extensions.md): When we last wrote about extending Xcode, we were living in a golden age, and didn’t even know it. Plugins allowed us to tweak pretty much everything about Xcode; Source Editor Extensions? Not so much. - [simctl](https://nshipster.com/simctl.md): With a mouse, anyone can use a computer, even if they aren’t a “computer person”. …though, if you are a “computer person”, you use keyboard shortcuts for most operations, and automate the rest from the Terminal. ## Open Source - [CocoaPods](https://nshipster.com/cocoapods.md): When well thought-out and implemented, infrastructure is a multiplying force that drives growth and development. In the case of Objective-C, CocoaPods has provided a much-needed tool for channeling and organizing open source participation. - [Language Server Protocol](https://nshipster.com/language-server-protocol.md): Apple’s adoption of LSP is arguably the most important decision they’ve made for Swift since releasing the language as open source in 2015. It’s a big deal for app developers, and it’s an even bigger deal for Swift developers on other platforms. - [Swift Program Distribution with Homebrew](https://nshipster.com/homebrew.md): If you want your software to reach the largest audience on macOS, write and publish a Homebrew formula for it. - [swift-sh](https://nshipster.com/swift-sh.md): Swift is a fast, safe, modern programming language. And with swift-sh, it’s never been easier to use it for scripting. ## Miscellaneous - [As We May Code](https://nshipster.com/as-we-may-code.md): What if, instead of lowering source code down for the purpose of execution, we raised it for the purpose of understanding? - [Bug Reporting](https://nshipster.com/bug-reporting.md): If you’ve ever been told to “file a Radar” and wondered what that meant, this week’s article has just the fix. - [Configuration Profiles](https://nshipster.com/configuration-profiles.md): One of the major criticisms of iOS as a platform is how locked down it is. iOS Configuration Profiles offer an interesting mechanism to work around these restrictions. - [Cross-Pollination](https://nshipster.com/cross-pollination.md): A brief essay about the flowering of ideas, written for the occasion of Earth Day. - [Dark Mode on iOS 13](https://nshipster.com/dark-mode.md): After waiting for what felt like an eternity (but was only, like, a year), Dark Mode is now finally coming to the iPhone and iPad in iOS 13. But will your app be ready on launch day? - [Device Identifiers and Fingerprinting on iOS](https://nshipster.com/device-identifiers.md): For every era, there’s a monster that embodies the anxieties of the age. - [Empathy](https://nshipster.com/empathy.md): We naturally want to help one another, to explain ideas, to be generous and patient. However, on the Internet, human nature seems to drop a few packets. - [Image Resizing Techniques](https://nshipster.com/image-resizing.md): Since time immemorial, iOS developers have been perplexed by a singular question: ‘How do you resize an image?’ This article endeavors to provide a clear answer to this eternal question. - [Inter-Process Communication](https://nshipster.com/inter-process-communication.md): In many ways, the story of Apple has been about fusing together technologies through happy accidents of history to create something better than before: OS X as a hybrid of MacOS & NeXTSTEP. Objective-C as the combination of Smalltalk’s OOP paradigm and C. iCloud as the byproduct of MobileMe and actual clouds (presumably). - [Manim](https://nshipster.com/manim.md): This year for Halloween, NSHipster is dressing up as 3blue1brown. And thanks to his open-source math animation library, we’re totally pulling it off. - [MapKit JS](https://nshipster.com/mapkit-js.md): Announced in 2018, MapKit JS takes the convenient cartographic capabilities of the MapKit framework on iOS and macOS, and brings them to the web. Join us as we provide turn-by-turn directions for how to start your journey with MapKit JS. - [Message-ID and Mail.app Deep Linking on iOS and macOS](https://nshipster.com/message-id.md): Privacy enhancements in recent versions of iOS have afforded users much greater control of how their information is shared. However, these improvements have come at a slight cost to certain onboarding flows. Rather than attempting to work around Apple’s privacy protections with techniques like device fingerprinting, we can instead rely on a longtime system integration with email. - [Model Context Protocol (MCP)](https://nshipster.com/model-context-protocol.md): Language Server Protocol (LSP) revolutionized how programming languages integrate with developer tools. Model Context Protocol (MCP) aims to do the same for a new generation of AI tools. - [Ollama](https://nshipster.com/ollama.md): While we wait for Apple Intelligence to arrive on our devices, something remarkable is already running on our Macs. Think of it as a locavore approach to artificial intelligence: homegrown, sustainable, and available year-round. - [Replay](https://nshipster.com/replay.md): Fast, reliable API tests without mocks or stale JSON fixtures. Replay records real HTTP traffic once (as HAR) and replays it instantly with Swift Testing so your networking code stays honest and your test suite stays fast. - [Secret Management on iOS](https://nshipster.com/secrets.md): One of the great unsolved questions in iOS development is, “How do I store secrets securely on the client?” - [Stewardship](https://nshipster.com/stewardship.md): Stewardship is an old word. It evokes the ethic of public service and duty. To be a steward is to embody the responsibilities that come with ownership. It is an act that justifies authority through continued accountability; both the greatest challenge and reward of creating and maintaining a project. - [Swift Development with Visual Studio Code](https://nshipster.com/vscode.md): VSCode is a cross-platform text and source code editor from Microsoft, and among the first tools to support Language Server Protocol. With LSP for Swift now shipping in Xcode, it’s a great time to see how this integration works for yourself. - [Uncertain⟨T⟩](https://nshipster.com/uncertainty.md): GPS coordinates aren’t exact. Sensor readings have noise. User behavior is probabilistic. Yet we write code that pretends uncertainty doesn’t exist, forcing messy real-world data through clean Boolean logic. - [WWDC 2019](https://nshipster.com/wwdc-2019.md): A look back at a mind-blowing week for Apple platform developers, and a look forward at the future of software development. - [WWDC 2020](https://nshipster.com/wwdc-2020.md): A brief remark about the excitement of Apple’s annual developer conference. - [bless](https://nshipster.com/bless.md): The process of booting a computer is a small miracle. Starting with a blank slate, a computer incrementally runs smaller, simpler programs to load larger, more capable programs into memory, until it finally has everything it needs to run the operating system itself. - [iCloud](https://nshipster.com/icloud.md): Perhaps what Apple is most renowned for is its consistent track record for creating great webservices. From consumer products like MobileMe and Ping to developer tools including the Provisioning Portal and iTunes Connect, Apple has continued to set new standards for convenience, robustness, and extensibility. - [iOS 12](https://nshipster.com/ios-12.md): Here at NSHipster, we’re interested in the nitty-gritty: the small (dare we say, obscure?) changes that add up to make a big impact to our day-to-day. In celebration of this week’s release of iOS 12, we’re sharing a few gems we found by trawling through API diffs. - [iOS 13](https://nshipster.com/ios-13.md): To mark last week’s release of iOS 13, we’re taking a look at some obscure (largely undocumented) APIs that you can now use in your apps. - [iOS 7](https://nshipster.com/ios7.md): With the NDA finally lifted, we can finally talk about all of the amazing new APIs in iOS 7. - [iOS 8](https://nshipster.com/ios8.md): Ask anyone, and they’ll tell you: WWDC 2014 was one of the most exciting in recent memory. This week, we’ll take a look beneath the headline features, and share some of the more obscure APIs that everyone should know about. - [iOS 9](https://nshipster.com/ios9.md): WWDC 2015 may not have packed quite as many fireworks as its predecessor, but neither was it short on the new and shiny. For this week’s issue, we’ll take a look at some of the changes that iOS 9 brings to the APIs we already know and love. - [macOS Accessibility Keyboard](https://nshipster.com/accessibility-keyboard.md): Beyond its immediate usefulness as an assistive technology, the Accessibility Keyboard challenges us to think differently about the nature of input methods and any remaining distinction between mobile and desktop computers. - [macOS Character Viewer](https://nshipster.com/character-viewer.md): Ever see a character and wonder what it was? Ever want to insert a character but couldn’t figure out how to type it? You can find the answer to these questions and many more at the bottom of the Edit menu in macOS. - [macOS Dynamic Desktop](https://nshipster.com/macos-dynamic-desktop.md): Dark Mode is one of the most popular additions to macOS — especially among us developer types. If you triangulate between that and Night Shift, introduced a couple of years prior, you get the Dynamic Desktop feature, new in Mojave. - [op run](https://nshipster.com/1password-cli.md): .env files can create friction in development workflows — especially as teams and projects grow over time. If you’re feeling this pain, the 1Password CLI (op) might be just what you need. ## Trivia - [NSHipster Quiz #1](https://nshipster.com/nshipster-quiz-1.md): Test your knowledge of general programming knowledge, Cocoa APIs, and Apple trivia in this first-ever NSHipster Quiz. How NSHip are you? - [NSHipster Quiz #2](https://nshipster.com/nshipster-quiz-2.md): Go up against some of the brightest minds in all things Apple at this special WWDC edition of NSHipster Quiz. Sure, you conform to the NSHipster protocol, but do you have what it takes to implement all of the @optional methods? Take the quiz and see for yourself! - [NSHipster Quiz #3](https://nshipster.com/nshipster-quiz-3.md): Test your mettle as NSHipster Pub Quiz goes on the road, to New York City! - [NSHipster Quiz #4](https://nshipster.com/nshipster-quiz-4.md): The fourth and final quiz of the year. Do you have what it takes to be the NSArray -firstObject among your peers? - [NSHipster Quiz #5](https://nshipster.com/nshipster-quiz-5.md): This fifth incarnation of the NSHipster Quiz took on a distinct North-of-the-Border flavor, as part of the NSNorth conference in Ottawa, Ontario. Think you’re up to the challenge, eh? - [NSHipster Quiz #6](https://nshipster.com/nshipster-quiz-6.md): Our second annual WWDC Pub Quiz! With dozens of teams, comprised of developers from all around the world, the competition was fierce. How will you stack up? - [NSHipster Quiz #7](https://nshipster.com/nshipster-quiz-7.md): Our third annual WWDC NSHipster Pub Quiz! Scores of developers, dozens of teams, and a down-to-the-wire finish. How will you fare? - [NSHipster Quiz #8](https://nshipster.com/nshipster-quiz-8.md): Our fourth annual WWDC NSHipster Pub Quiz! Nearly two hundred developers, teamed up and competing with themselves and each other for a chance to ask: “Wait, what?” It’s time for the home edition—sharpen your pencil and give it your best! ## Objective-C - [#pragma](https://nshipster.com/pragma.md): #pragma declarations are a mark of craftsmanship in Objective-C. Although originally used to make source code compatible across different compilers, Xcode-savvy programmers use #pragma to very different ends. - [@](https://nshipster.com/at-compiler-directives.md): If we were to go code-watching for Objective-C, what would we look for? Square brackets, ridiculously long method names, and @’s. - [Associated Objects](https://nshipster.com/associated-objects.md): Associated Objects is a feature of the Objective-C 2.0 runtime, which allows objects to associate arbitrary values for keys at runtime. It’s dark juju, to be handled with as much caution as any other function from objc/runtime.h - [BOOL / bool / Boolean / NSCFBoolean](https://nshipster.com/bool.md): Encoding our logical universe into the cold, calculating bytecode of computers forces us to deal with these questions one way or another. And as you’ll see from our discussion of Boolean types in Objective-C, truth is indeed stranger than fiction. - [Benchmarking](https://nshipster.com/benchmarking.md): Abstractions are necessary for doing meaningful work, but they come at a cost. By benchmarking, a programmer can uncover the hidden performance characteristics of their code, and use this information to optimize accordingly. - [C Storage Classes](https://nshipster.com/c-storage-classes.md): In C, the scope and lifetime of a variable or function within a program is determined by its storage class. Understanding these storage classes allows us to decipher common incantations found throughout Objective-C - [Equality](https://nshipster.com/equality.md): The concept of equality is a central topic in philosophy and mathematics, with far-reaching implications for matters of ethics, justice, and public policy. Our task as programmers is to reconcile our logical and physical understanding of equality with the domains we model. - [Extended File Attributes](https://nshipster.com/extended-file-attributes.md): Amidst revelations of widespread spying by the NSA, the concept of metadata has taken an unexpected role in the national conversation about government surveillance. What is it? And how much does it reveal about us and our daily habits? These are questions that the American people are asking, and they deserve an answer. - [Method Swizzling](https://nshipster.com/method-swizzling.md): Method swizzling is the process of changing the implementation of an existing selector. It’s a technique made possible by the fact that method invocations in Objective-C can be changed at runtime, by changing how selectors are mapped to underlying functions in a class’s dispatch table. - [Namespacing](https://nshipster.com/namespacing.md): Namespacing is the preeminent bugbear of Objective-C. A cosmetic quirk with global implications, the language’s lack of identifier containers remains a source of prodigious quantities of caremad for armchair language critics. - [Object Subscripting](https://nshipster.com/object-subscripting.md): Xcode 4.4 quietly introduced a syntactic revolution to Objective-C. Like all revolutions, however, its origins and agitators require some effort to trace. - [Objective-C Direct Methods](https://nshipster.com/direct.md): It’s hard to get excited when new features come to Objective-C. These days, any such improvements are in service of Swift interoperability rather than an investment in the language itself. So it was surprising to learn about a recent patch to Clang. - [Type Encodings](https://nshipster.com/type-encodings.md): From number stations and numerology to hieroglyphics and hobo codes, there is something truly fascinating about finding meaning that hides in plain sight. Though hidden messages in and of themselves are rarely useful or particularly interesting, it’s the thrill of the hunt that piques our deepest curiosities. - [\_\_attribute\_\_](https://nshipster.com/__attribute__.md): A recurring theme of this publication has been the importance of a healthy relationship with the compiler. Like any craft, one’s effectiveness as a practitioner is contingent on how they treat their tools. Take good care of them, and they’ll take good care of you. - [instancetype](https://nshipster.com/instancetype.md): Objective-C is a rapidly evolving language, in a way that you just don’t see in established programming languages. Developments range from the mundane to paradigm-changing, but telling the difference takes practice. Because we’re talking about low-level language features, it’s difficult to understand what implications they may have higher up with API design. - [nil / Nil / NULL / NSNull](https://nshipster.com/nil.md): Understanding the concept of nothingness is as much a philosophical issue as it is a pragmatic one. - [rand(3) / random(3) / arc4random(3) / et al.](https://nshipster.com/random.md): What passes for randomness is merely a hidden chain of causality. Of course, app developers could care less about philosophy—what they want is code. Thus, our goal this week: to clear up all of the lingering questions and misunderstandings about doing random things in Objective-C ## Reader Submissions - [Reader Submissions - New Year's 2013](https://nshipster.com/new-years-2013.md): In celebration of the forthcoming year++, I thought it’d be fun to compile a list of some of your favorite tips and tricks of the trade. Readers were asked to submit their favorite piece of Objective-C trivia, framework arcana, hidden Xcode feature, or anything else they thought is cool. - [Reader Submissions - New Year's 2014](https://nshipster.com/new-years-2014.md): As we prepare to increment our NSDateComponents -year by 1, it’s time once again for NSHipster end-of-the-year Reader Submissions! - [Reader Submissions - New Year's 2015](https://nshipster.com/new-years-2015.md): 2014 was an incredible year professionally for Apple developers. With a deluge of new developments—both from Cupertino and the community at large—there was no shortage of interesting tidbits for readers to share. - [Reader Submissions - New Year's 2016](https://nshipster.com/new-years-2016.md): With 2015 behind us and the new year begun, it’s time again for an NSHipster tradition: reader submissions! As in years past, this installment is chock full of tips and tricks that can help ease your days working with Xcode, Swift, and Objective-C. ## Optional - [Flight School](https://nshipster.com/flight-school.md): A new book series for advanced Swift developers from the creators of NSHipster, with comprehensive guides for Codable, Numbers, and Strings. Now updated for Swift 5 and available in print. - [Privacy Policy](https://nshipster.com/privacy.md): NSHipster doesn’t set cookies or track its readers. Here’s what happens to information about your visit. - [Article Status](https://nshipster.com/status): When each article was last reviewed, and the Swift version it uses. - [Atom Feed](https://nshipster.com/feed.xml): The ten most recently published or revised articles. - [Sitemap](https://nshipster.com/sitemap.xml): The pages of every article and author. - [Croath Liu](https://nshipster.com/authors/croath-liu): Croath Liu (@cr0ath) is an iOS developer and one of the lead translators for nshipster.cn. He lives in Beijing. - [Delisa Mason](https://nshipster.com/authors/delisa-mason): Delisa Mason (@kattrali) is the creator of the Xcode Package Manager, Alcatraz, as well as a CocoaPods Core Team member. - [Em Lazer-Walker](https://nshipster.com/authors/em-lazer-walker): Em Lazer-Walker (@lazerwalker) makes experimental games, interactive art, and software tools. - [Jack Flintermann](https://nshipster.com/authors/jack-flintermann): Jack Flintermann is a software developer at Stripe. He lives in New York City. - [jemmons](https://nshipster.com/authors/jemmons): Josh (@jemmons) has led mobile development at graphic.ly, Reverb, and now Retail Zipline. He lives in Chicago and writes about Swift at figure.ink. - [Jordan Morgan](https://nshipster.com/authors/jordan-morgan): Jordan Morgan is a software developer from Ozark, who created Dreaming In Binary as a creative outlet for his side projects. Currently, he is an iOS engineer at Buffer. Jordan is focused on helping the community by doing talks about iOS and remote work and writing books and blogs posts, and considers himself a lifelong student for all forms of software engineering. - [Matt Massicotte](https://nshipster.com/authors/matt-massicotte): Matt is a long-time developer for Apple platforms. He’s into programming, the outdoors, video games, music, and progress towards a safe and fair world for all people. - [Mattt](https://nshipster.com/authors/mattt): Mattt (@mattt) is a writer and developer in Portland, Oregon. - [Natasha Murashev](https://nshipster.com/authors/natasha-murashev): Natasha (aka @NatashaTheRobot) is an iOS developer by day and a robot by night. She organizes the try! Swift Conference around the world. She’s currently living the digital nomad life as her alter identity: @NatashaTheNomad. - [Nate Cook](https://nshipster.com/authors/nate-cook): Nate Cook (@nnnnnnnn) is an independent web and application developer who writes frequently about topics in Swift, and the creator of SwiftDoc.org. - [Reda Lemeden](https://nshipster.com/authors/reda-lemeden): Reda Lemeden is a UI designer and developer making software on both Apple platforms and the Web. He has a penchant for layout engines, grids, and color theory. - [Zoë Smith](https://nshipster.com/authors/zoe-smith): Zoë Smith (@zoejessica) is a software developer for Apple platforms and the creator of AccessControlKitty and F***ingIfCaseLetSyntax.com.