- Top 100 Albums app – my approach to a code exercise
- Building an iOS app around the Unsplash API
- AppDeveloperKit-String: A Swift library for subscripting, regular expression matching and substitutions
- Solving a HackerRank algorithm problem – Matrix Layer Rotation
- AppDeveloperKit – reusable, configurable Swift classes for iOS
- Leave Swift Error Propagation Enabled
- Error reporting for complex unit tests
- Debugging in LLDB with command regex
- Thinking outside the box to debug: Charles Proxy, push and a forced crash
- Swift framework development for binary distribution with CocoaPods
Monthly Archives: December 2012
I was reading the Apple document “Cocoa Fundamentals Guide” and ran across some nice class hierarchy charts for Foundation classes that I thought I’d share. They are located in the section of the document called “What Is Cocoa?“.
These diagrams logically group the classes of the Foundation framework in categories. Classes in blue-shaded areas are present in both the OS X and iOS versions of Foundation; classes in gray-shaded areas are present only in the OS X version.
I was first introduced to Instruments in the CS193P course that I took over the past few months. I found them to be invaluable for debugging memory leaks as I work on my Address Book iPhone app.
In creating my first iPhone app which uses the Address Book, I discovered the world of memory management with iOS. I wanted to share a few things I’ve learned and provide lots of links for your reference.
ARC, retain counts and CFRelease
Admittedly, if you stick strictly to Foundation code, you probably don’t need to be concerned too much about what happens under the hood. With the introduction of ARC (Automatic Reference Counting), iOS takes care of much of this for you. It’s when you also need to deal with Core Foundation (CF), which the Address Book uses, that things become tricky. CF has a concept of object ownership and memory management using retain counts. An object can have multiple owners (retain count > 1), but when you are done with that object the retain count had better be zero or you’ll create memory leaks. To accomplish this, you need to use CFRelease().
I was new to the Mac up until about 5 months ago. One of the first tools I realized that I wanted was a good clipboard manager. Why? I make extensive use of notes (Evernote), code comments and README files to paste examples of code, links to references, etc. I often found myself switching back and forth between windows with copy/paste, copy/paste, etc. What I really wanted was to maximize my efficiency with copy, copy, copy … followed by paste, paste, paste …
I ran across a good article at Macworld that helped me identify some top contenders quickly: Essential Mac utilities: clipboard managers | Macworld.
From the list of clipboard managers, I tried CopyPaste Pro and PTHPasteboard Pro. I eventually stuck with the latter. It fit better into my workflow, had some advanced paste features, and allowed me to exclude some tools from copying (such as 1Password) so that I wasn’t putting sensitive information like passwords onto my clipboard.