Mattt
Mattt (@mattt) is a writer and developer in Portland, Oregon.
Articles
-
As We May Code
What if, instead of lowering source code down for the purpose of execution, we raised it for the purpose of understanding?
-
WWDC 2020
A brief remark about the excitement of Apple’s annual developer conference.
-
Cross-Pollination
A brief essay about the flowering of ideas, written for the occasion of Earth Day.
-
Contact Tracing
Apple and Google announced a joint initiative to deploy contact tracing functionality to the billions of devices running iOS or Android in the coming months. In this article, we’ll take a first look at these specifications — particularly, Apple’s proposed ExposureNotification framework — in an effort to anticipate what this will all look like in practice.
-
Swift Logging
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.
-
Xcode Build Configuration Files
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. -
Static and Dynamic Callable Types in Swift
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.
-
RawRepresentable
Programming is about typing. And programming languages are typically judged by how much they make you type — in both senses of the word.
-
@
If we were to go code-watching for Objective-C, what would we look for? Square brackets, ridiculously long method names, and
@
’s. -
Objective-C Direct Methods
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.
-
Swift API Availability
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.
-
bless
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.
-
KeyValuePairs
A look at an obscure, little collection type that challenges our fundamental distinctions between
Array
,Set
, andDictionary
. -
Secret Management on iOS
One of the great unsolved questions in iOS development is, “How do I store secrets securely on the client?”
-
Message-ID and Mail.app Deep Linking on iOS and macOS
Privacy enhancements to privacy 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.
-
Device Identifiers and Fingerprinting on iOS
For every era, there’s a monster that embodies the anxieties of the age.
-
MetricKit
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.
-
SwiftUI Previews on macOS Catalina and Xcode 11
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.
-
iOS 13
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.
-
Apple Push Notification Device Tokens
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?
-
Dark Mode on iOS 13
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 iOS 13. But will your app be ready on launch day?
-
Identifiable
Swift 5.1 gives us yet another occasion to ponder ontological questions and weigh in the relative merits of various built-in types as stable identifiers.
-
macOS Accessibility Keyboard
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.
-
Formatter
Conversion is a tireless errand in software development. Most programs boil down to some variation of transforming data into something more useful.
-
CAEmitterLayer
This week mark’s NSHipster’s 7th anniversary! And what better way to celebrate the occasion than to implement a fun and flexible confetti view on iOS?
-
Swift Property Wrappers
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.
-
WWDC 2019
A look back at a mind-blowing week for Apple platform developers, and a look forward at the future of software development.
-
Swift Code Formatters
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. -
Image Resizing Techniques
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.
-
CoreGraphics Geometry Primitives
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.
-
Guided Access
Improve your analog device interactions with this one weird accessibility trick.
-
UITableViewHeaderFooterView
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?
-
LocalizedError, RecoverableError, CustomNSError
We’re all familiar with the
Error
type, but have you met these related Swift Foundation error protocols? -
MapKit JS
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.
-
JavaScriptCore
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.
-
API Pollution in Swift Modules
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.
-
Regular Expressions in Swift
Regular expressions are a powerful tool for working with text, but it’s often a mystery how to use them in Swift.
-
ExpressibleByStringInterpolation
Swift 5 overhauls how values in string literals are interpolated, and incidentally overturned several decades’ worth of problematic programming conventions.
-
TextOutputStream
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. -
swift-sh
Swift is a fast, safe, modern programming language. And with
swift-sh
, it’s never been easier to use it for scripting. -
Swift Import Declarations
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?
-
Bundles and Packages
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.
-
macOS Character Viewer
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.
-
Swift Program Distribution with Homebrew
If you want your software to reach the largest audience on macOS, write and publish a Homebrew formula for it.
-
simctl
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.
-
Swift Development with Visual Studio Code
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.
-
CustomPlaygroundDisplayConvertible
Playgrounds use a combination of language features and tooling to provide a real-time, interactive development environment. With the
Custom
protocol, you can leverage this introspection for your own types.Playground Display Convertible -
Language Server Protocol
Apple’s adoption of LSP is arguably the most important decision they’ve made for Swift since releasing the language as open source in 2014. It’s a big deal for app developers, and it’s an even bigger deal for Swift developers on other platforms.
-
Void
Void has no members: no methods, no values, not even a name. It’s a something more nothing than
nil
. -
SwiftSyntax
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.
-
numericCast(_:)
Getting code to compile is different than doing things correctly. But sometimes it takes the former to ultimately get to the latter.
-
TimeInterval, Date, and DateInterval
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.
-
macOS Dynamic Desktop
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.
-
iOS 12
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.
-
CMMotionActivity
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.
-
NSDataAsset
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.
-
Swift Property Observers
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.
-
Hashable / Hasher
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 classes:Dictionary
andSet
-
NLLanguageRecognizer
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.
-
Never
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.
-
Password Rules / UITextInputPasswordRules
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.
-
Bug Reporting
If you’ve ever been told to “file a Radar” and wondered what that meant, this week’s article has just the fix.
-
Swift GYB
Not all code can be glamorous. In fact, a lot of the low-level infrastructure that makes everything work is a slog of boilerplate.
-
guard & defer
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.
-
Mirror / CustomReflectable / CustomLeafReflectable
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?
-
Swift Documentation
Code structure and organization is a matter of pride for developers. Clear and consistent code signifies clear and consistent thought.
-
Reader Submissions -
New Year's 20152014 was an incredible year professionally for Apple developers. With a deluge of new developments—both from Cupertino and the community at large—there were no shortage of interesting tidbits for readers to share.
-
The Death of Cocoa
For many of us, the simplicity, elegance, and performance of Apple’s hardware and software working together are the reason why we build on their platforms. And yet, after just a few months of working with Swift, Cocoa has begun to lose its luster.
-
WatchKit
After taking a look at WatchKit, there were a few things that jumped out coming from UIKit. They’re the kind of subjective, opinionated things that don’t make for good documentation, but might be interesting or useful to anyone else as they’re getting started.
-
Inter-Process Communication
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).
-
Swift System Version Checking
C uses preprocessor directives capable of unspeakable evil. Swift has a safe subset of preprocessor directives. So how do we check system version for API compatibility?
-
UIAlertController
Did you know that
UIAlert
andView UIAction
(as well as their respective delegate protocols) are deprecated in iOS 8? It’s true.Sheet -
Equatable and Comparable
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.
-
PHImageManager
Yesterday’s article described various techniques for resizing images using APIs from the UIKit, Core Graphics, Core Image, and Image I/O frameworks. However, that article failed to mention some rather extraordinary functionality baked into the new Photos framework which takes care of all of this for you.
-
OptionSet
Objective-C uses the
NS_OPTIONS
macro to define set of values that may be combined together. Swift imports those types as structures conforming to theOption
protocol. But could new language features in Swift provide a better option?Set -
Swift Default Protocol Implementations
Protocols are the foundation of generics in Swift, but suffer from the lack of a built-in way to provide default implementations for methods. However, there is an interesting workaround in Swift that you probably haven’t noticed.
-
WKWebView
iOS has a complicated relationship with the web. And it goes back to the very inception of the platform over a decade ago.
-
Swift Literals
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 Operators
Operators are what do the work of a program. They are the very execution of an executable; the teleological driver of every process.
-
Alamofire
Although we still have a few months to wait before we can ship apps in Swift, there is already a proliferation of open source projects built with this new language. One such project is Alamofire.
-
XCTestCase /
XCTestExpectation /
measureBlock()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:XCTest
and performance tests.Expectation -
NSOperation
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.
-
NSCalendarUnitYear
NSHipster.com was launched 2 years ago to the day. Each week since has featured a new article on some obscure topic in Objective-C or Cocoa (with only a couple gaps). Let’s celebrate with some cake.
-
Clang Diagnostics
Diagnostics combine logic with analytics to arrive at a conclusion. It’s science and engineering at their purest. It’s human reasoning at its most potent. For us developers, our medium of code informs the production of subsequent code, creating a positive feedback loop that has catapulted the development of technology exponentially over the last half century. For us Objective-C developers specifically, the most effective diagnostics come from Clang.
-
iOS 8
Ask anyone, and they’ll tell you: WWDC 2014 was the 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.
-
NSHipster Quiz #6
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?
-
CocoaPods
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.
-
Benchmarking
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.
-
NSHipster Quiz #5
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?
-
IBAction / IBOutlet / IBOutletCollection
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
-
MKGeodesicPolyline
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.
-
UIActivityViewController
iOS provides a unified interface for users to share and perform actions on strings, images, URLs, and other items within an app.
-
Xcode Plugins
This week on NSHipster: a roundup of some of the most useful and exciting plugins for Xcode—ready for you to try out yourself today!
-
Configuration Profiles
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.
-
AVSpeechSynthesizer
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.
-
NSURL /
NSURLComponentsOf 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.
-
Empathy
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.
-
Dictionary Services
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.
-
Temporary Files
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).
-
Namespacing
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.
-
Method Swizzling
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.
-
Associated Objects
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
-
MKTileOverlay,
MKMapSnapshotter &
MKDirectionsUnless 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 maps on iOS have gotten quite a bit better in the intervening releases. Quite good, in fact.
-
Stewardship
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.
-
Extended File Attributes
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.
-
NSRange
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.
-
Reader Submissions -
New Year's 2014As we prepare to increment our NSDateComponents -year by 1, it’s time once again for NSHipster end-of-the-year Reader Submissions!
-
UIApplicationDelegate launchOptions
AppDelegate is the dumping ground for functionality in iOS.
-
Multipeer Connectivity
As consumer web technologies and enterprises race towards cloud infrastructure, there is a curious and significant counter-movement towards connected devices. The Multipeer Connectivity APIs, introduced in iOS 7, therefore may well be the most significant for the platform.
-
NSNotification &
NSNotificationCenterAny idea is inextricably linked to how its 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.
-
FileManager
File
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.Manager -
xctool
Control the build system, and you control the destiny of the language, its ecosystem, and community.
-
NSHipster Quiz #4
The fourth and final quiz of the year. Do you have what it takes to be the
NSArray -first
among your peers?Object -
Launch Arguments &
Environment VariablesThere 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.
-
NSError
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.
-
Key-Value Observing
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.
-
Xcode Key Bindings & Gestures
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.
-
iOS 7
With the NDA finally lifted, we can finally talk about all of the amazing new APIs in iOS 7.
-
AFNetworking 2.0
AFNetworking is one of the most widely used open source projects for iOS and OS X development. It’s about as mainstream as it gets. But have you heard about the sequel?
-
Network Link Conditioner
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.
-
Xcode Snippets
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
-
Equality
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.
-
NSHashTable & NSMapTable
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.
-
rand(3) / random(3) / arc4random(3) / et al.
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
-
Objective-C Documentation
There’s an adage among Cocoa developers that Objective-C’s verbosity lends its code to being effectively self-documenting. Between longMethodNamesWithNamedParameters: and the explicit typing of those parameters, Objective-C methods don’t leave much to the imagination.
-
NSHipster Quiz #3
Test your mettle as NSHipster Pub Quiz goes on the road, to New York City!
-
UIMenuController
Mobile usability today is truly quite remarkable—especially considering how far it’s come in just the last decade. What was once a clumsy technology relegated to the tech elite has now become the primary mode of computation for a significant portion of the general population.
-
NSPredicate
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.
-
NSExpression
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
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.
-
NSUUID /
CFUUIDRef /
UIDevice -uniqueIdentifier /
-identifierForVendorUntil recently, it was trivial to uniquely identify devices between application launches, and even across applications: a simple call to UIDevice -uniqueIdentifier, and you were all set.
-
Object Subscripting
Xcode 4.4 quietly introduced a syntactic revolution to Objective-C. Like all revolutions, however, its origins and agitators require some effort to trace.
-
NSHipster Quiz #2
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!
-
NSDataDetector
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.
-
Unit Testing
Unit Testing is an emotional topic for developers. It inspires a sense of superiority to its most zealous adherents, and evokes a feeling of inadequacy to non-practitioners. Cargo Cults like TDD stake their reputation on unit testing to the point of co-opting and conflating utility with morality.
-
Core Data Libraries & Utilities
We were a bit hard on Core Data last week, so for this issue of NSHipster, we bring you a guided tour of the best open source libraries for working with Core Data. Read on to see how you might make the most from your Core Data experience.
-
NSCoding / NSKeyedArchiver
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.
-
GPUImage
GPUImage is a BSD-licensed iOS library that lets you apply GPU-accelerated filters and other effects to images, live camera video, and movies. If you’re not careful, you may well end up creating a camera app by the end of the article.
-
MKLocalSearch
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.
-
NSHipster Quiz #1
Test your knowledge of general programming knowledge, Cocoa APIs, and Apple trivia in this first-ever NSHipster Quiz. How NSHip are you?
-
NSSecureCoding
A short post for this week: everything you need to know about NSSecureCoding.
-
BOOL / bool / Boolean / NSCFBoolean
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.
-
iCloud
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.
-
Search Kit
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.
-
C Storage Classes
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
-
UIAppearance
UIAppearance allows the appearance of views and controls to be consistently defined across the entire application.
-
Back Row
Back Row is a private framework used in the Apple TV user experience. Rather than waiting for Apple to open up the Apple TV SDK, one can take matters into their own hands.
-
NSAssertionHandler
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.
-
ReactiveCocoa
Breaking from a tradition of covering Apple APIs exclusively, this edition of NSHipster will look at an open source project that exemplifies a brave new era of open source contribution to Objective-C: ReactiveCocoa.
-
NSURLCache
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.
-
Type Encodings
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.
-
NSValue
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.
-
NSLocalizedString
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.
-
__attribute__
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.
-
nil / Nil / NULL / NSNull
Understanding the concept of nothingness is as much a philosophical issue as it is a pragmatic one.
-
Reader Submissions -
New Year's 2013In 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. -
instancetype
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.
-
KVC Collection Operators
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 sleeves.
-
NSOrderedSet
Why isn’t NSOrderedSet a subclass of NSSet? The answer may surprise you.
-
NS_ENUM & NS_OPTIONS
A skilled Objective-C developer is able to gracefully switch between Objective and Procedural paradigms, and use each to their own advantage.
-
ValueTransformer
Value
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.Transformer -
NSURLProtocol
Foundation’s URL Loading System is something that every iOS developer would do well to buddy up with. And of all of networking classes and protocols of Foundation, NSURLProtocol is perhaps the most obscure and powerful.
-
UILocalizedIndexedCollation
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.
-
NSLinguisticTagger
NSLinguisticTagger is a veritable Swiss Army Knife of linguistic functionality, with the ability to tokenize natural language strings into words, determine their part-of-speech & stem, extract names of people, places, & organizations, and tell you the languages & respective writing system used in the string.
-
AddressBookUI
Address Book UI is an iOS framework for displaying, selecting, editing, and creating contacts in a user’s Address Book. Similar to the Message UI framework, Address Book UI contains a number of controllers that can be presented modally, to provide common system functionality in a uniform interface.
-
#pragma
#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. -
UICollectionView
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.
-
CharacterSet
Character
isn’t a set and it doesn’t containSet 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. -
UIAccessibility
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.
-
Locale
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 privelage to travel or to meet people from other places, you may not even be aware that things could be any other way.
-
CFBag
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.
-
NSIncrementalStore
Even for a blog dedicated to obscure APIs,
NSIncremental
sets a new standard. It was introduced in iOS 5, with no more fanfare than the requisite entry in the SDK changelog. Ironically, it is arguably the most important thing to come out of iOS 5, which will completely change the way we build apps from here on out.Store -
CFStringTransform
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.
-
DateComponents
Date
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.Components -
NSSortDescriptor
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?
-
NSCache
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.
-
NSIndexSet
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.