Nov 05, 2012
In the blog post before this one I began my investigation into TCP connectivity and Bonjour. I set out to create DTBonjour as part of my DTFoundation set of tools to make communicating between Macs and iOS devices extremely easy.
Then I spent a couple of hours on putting together a proof-of-concept app that would show me what’s still missing on the API. Having some classes disconnected from real life use is quite a different ballgame than actually showing it in action.
I asked on Twitter for some suggestions what app to make to show this off, but all where way more involved than the example that I finally decided on: a simple Chat app.
Nov 02, 2012
For my Mac-based iCatalog Editor app I am developing a preview mode that allows for on-device previewing of iCatalogs. This is modeled after the Preview mode in iBooks Author with the tiny difference that there Apple restricts the preview feature to iPads connected via USB, which we will be using the full power of Bonjour to use any app that is running our specialized iCatalog Viewer app on the local WiFi network.
Apple has done a great job making service publishing and discovery a breeze. However they are severely lacking in the object-oriented Sockets department. in this blog post I’ll be developing an Objective-C library that will greatly simplify the process of finding, connecting and communicating with other devices.
And since we are developing for iOS and OS X in parallel the resulting code will work on Mac and iOS devices just the same.
Oct 31, 2012
For the toolbar in my iCatalog Editor Mac app I wanted to have have a toolbar button that would show a drop down menu for selecting what kind of hot zone the user wants to insert. iBook Author has a button like this and I was searching for way to get a similar look.
AppKit does not have this as a standard component, but I found two approaches that would yield a similar looking result.
Oct 24, 2012
For an inspector panel I wanted to have a horizontal collection view contained inside a vertical inspector scroll view. The vertical scroll view would only scroll if the window was too small to show all sections in the inspector.
The problem there is a NSScrollView gobbles up all scroll wheel events if the mouse pointer is on top of it. Here’s a solution how to have it selectively forward the scroll events up the responder chain.
Sep 29, 2012
Do you remember, back when you first opened Interface Builder?
How long did it take you to understand the purpose of File’s Owner?
That is a proxy for the object that loads this NIB, usually a UIViewController. This allows you to connect IBOutlets and IBActions with elements contained in the NIB file. IB knows about these because you tell it what class the File’s Owner has and from parsing this class’ header it finds all things that you can connect to by the IBOutlet and IBAction keyword.
That one was easy. Second question: How long did it take you to understand the purpose of First Responder?
If you are like me then you started out developing for the iPhone and other iOS devices. And then you probably also learned to ignore this proxy object because on iOS it does not serve an obvious purpose. In fact you can go for years developing iOS apps without ever doing anything with it. I know I did.
It is only know that I am starting to dabble in developing for the Mac that I had to begin to develop and appreciation for the responder chain. And so finally I understand the purpose and usefulness of the “First Responder” object and I want to share this with you.
Sep 28, 2012
… no, were not talking about the kind of fun that burns when taking a leak. In this article I want to summarize what I learned over the past weeks about working with Universal Type Identifiers.
On Windows files where always only identified by their file extension. In the olden days Apple was using multiple additional methods of determining what to do with certain files, amongst them HFS codes and MIME types.
The modern way to deal with file types is to use UTIs which are typically a reverse domain name, like “public.html” for a generic HTML file or ”com.adobe.pdf” by the PDF type created by Adobe. UTIs have an additional advantage that other methods of identifying types do not possess: a file can actually possess multiple types.
Sep 21, 2012
The great thing about building apps for both iOS and Mac is that many pieces of code work just the same on both platforms. There are some scenarios however where you want to add different kinds of Apple SDKs based on which platform you are building for.
A good place to put all headers that often used is the Precompiled Header File (PCH) which gets precompiled and then reused throughout your app. Whenever you have an #import statement in your code the compiler needs to figure out whether this header has already been imported because the same header file can potentially be imported from several locations.
I generally like to put all imports for Apple headers into my PCH file as well as my own app-wide classes like my DTFoundation library which has a growing selection of methods that I frequently use. Having these imports in the PCH means that the preprocessor can prepare them for faster compiling once and then can virtually prepend all these definitions for every source code file.
Today I learned something new, namely how you can use the same PCH for Mac as well as iOS.
Sep 20, 2012
In the first part of this series we started out by setting up the document type and export the UTI for the system to know about it. We also implemented methods to read the index from a file wrapper as well as persisting it to a new one. These steps where sufficient that we ended up with all the file manipulation candy (reverting to earlier versions, new doc, etc.) functional.
I promised that we would get go something more interesting today. We’ll be wiring up an NSCollectionView to show thumbnails and names of our images contained in shoebox documents. Then we need to dive into pasteboard as well drag-and-drop functionality to be able to manipulate those shoebox images. We want to be able to drag images from Desktop into shoeboxes and – time permitting – also be able to change their order by dragging as well.
Please let me know if this kind of tutorial is of interest to you by using the Flattr button and/or sharing it in your favorite social network.
Sep 19, 2012
I’ve been programming for the iOS platform ever since this is possible, since the iPhone 3G with iPhone OS 2.0 was released by Apple in Summer 2008. For all this time I had a healthy respect about programming for Mac. More precisely: Horror.
If you dig into it you can only applaud Apple for not having tried to craft touch screen and energy optimization stuff onto AppKit, but chose to go the forked OS route. Being a seasoned iOS developer you will find yourself often cursing about how complicated certain activities seem.
Having said that you also see the positive influence of iOS on AppKit all around. Now that Apple deprecated Garbage Collection and you are already well used to programming under the ARC paradigm you find yourself writing exactly the same code for both platforms more often than not.
This will be the first in a series of tutorials where I am sharing my experiences in diving into AppKit. Please let me know if this is in fact interesting to you by sharing and Flattr’ing it.