top
about archive search zqueue.com
Matt Gallagher: Cocoa with Love Matt Gallagher: Cocoa with Love
← Newer 1 2 3 4 5 6 7 8 9 Older →
  • Errors: unexpected, composite, non-pure, external.

    Mar 17, 2016

    Error handling is a topic I plan to visit periodically but it's difficult since 'error' is such a poorly defined term. In this article, I give a clear definition of an error and further define the most common associated complications. The intent is to establish a foundation for future discussions on the topic.
    Read more...
  • Gathering system information in Swift with sysctl

    Mar 8, 2016

    Another debug analysis post, this time looking at gathering basic system information for attaching to diagnostic reports and other forms of reporting.
    Read more...
  • Tracking tasks with stack traces in Swift

    Feb 28, 2016

    In this tongue-twister titled article, I discuss capturing control flow information with stack traces during ongoing tasks to aid debugging. Also included: a reimplementation of NSThread.callStackReturnAddresses in Swift for faster and more flexible stack traces.
    Read more...
  • Use it or lose it: why safe C is sometimes unsafe Swift

    Feb 16, 2016

    Swift and C have different memory layouts. This means that using Swift to call C functions in a manner that would be valid in C can cause memory safety problems. I'll show how this can occur with a subtle Release build bug inspired by issues that occurred while writing the previous article.
    Read more...
  • Partial functions in Swift, Part 2: Catching precondition failures

    Feb 2, 2016

    Partial functions are risky but if you're going to write one anyway, you should do something completely crazy to test that it is risky in all the right places.
    Read more...
  • Partial functions in Swift, Part 1: Avoidance

    Jan 25, 2016

    Partial functions (functions with preconditions) are a risky design choice. You probably have a few in your program, even if you haven't clearly identified them. Learn how to recognize them, learn about their risks, learn to avoid them and learn why you might choose to use them anyway.
    Read more...
  • A new era for Cocoa with Love

    Jan 25, 2016

    I'm drawing a line between the old Objective-C era posts on Cocoa with Love and the Swift era posts. The aim of the new era will be to make app programming suck less through a broad theme: "maintainable Cocoa apps". If we program with fewer runtime errors and new features are easier to add, we'll have more fun – even if "maintainable" sounds like a dull word.
    Read more...
  • A big weakness in Objective-C's weak typing

    Jun 30, 2011 (an Objective-C era article)

    We generally assume that we can send any message we want to a variable in our code typed as "id" and Objective-C's dynamic message handling will make the invocation work correctly at runtime. In some rare cases, this assumption is wrong. I'll look at situations where you need to be careful about sending messages to "id" typed variables and a situation where a limitation in the Objective-C language requires a hideous workaround to avoid serious bugs.
    Read more...
  • An RSS-feed and location-based iOS application

    Jun 19, 2011 (an Objective-C era article)

    The purpose of this post is so that I will have a link to give people when they ask: how do I write an iOS application that pulls data from an RSS feed, displays it pretty and can put things on a map. I'll show you all of that and more as I rewrite my oldest iOS application from scratch: FuelView.
    Read more...
  • Classes for fetching and parsing XML or JSON via HTTP

    May 30, 2011 (an Objective-C era article)

    In this post I show two reusable classes for fetching data via HTTP: one that parses the result as XML and another that parses as JSON. These are relatively simple tasks but due to the number of required steps, they can become tiresome if you don't have robust, reusable code for the task. These classes will work on iOS or on the Mac but the optional error alerts and password dialogs are only implemented for iOS.
    Read more...
← Newer 1 2 3 4 5 6 7 8 9 Older →
  • Subscribe: RSS or JSON
  • Twitter: @cocoawithlove
  • Github: mattgallagher

© 2008-2021 Matt Gallagher. All rights reserved.
Code may be used in accordance with license on About page.
If you need to contact me: