Debugging Apple Watch Apps

My first hurdle with WatchKit was how to debug  a Watch App. I added the Watch App target to my test app and I can see the Watch App interface storyboard. I can also see the WatchKit Extension that contains code for the Watch App. When I debug the Watch App I see the default methods logging but how do I actually see the watch interface?

Some searching through the simulator’s menus revealed the answer. Under Hardware – External Displays there are options for Apple Watch – 38mm and Apple Watch – 42 mm! These allow you to see a simulated Apple Watch screen.


Screen Shot 2014-11-19 at 1.52.00 PM


Apple WatchKit

Apple released Xcode 6.2 beta yesterday and it includes our first look at the WatchKit SDK that will be used to create apps for the Apple Watch. I’ll be exploring this new SDK and publishing some posts about my experiences with WatchKit.

So far I’m a bit disappointed by how limited the SDK is. You can’t write a stand alone watch app. Watch apps must be tied to an iOS app. You also can’t write any code that will run directly on the device. The watch is merely an extension of the phone’s user interface. Actions performed by the user on the watch cause code to be executed in code that runs on the phone.

I’ll get into more of this in future posts.


Swift: Using Grand Central Dispatch (GCD)

Grand Central Dispatch is a C API unlike other APIs that expose Objective-C classes. However, that doesn’t mean you can’t call GCD functions, or any other C API functions, directly from Swift. The C API functions are exposed to Swift just like they are in Objective-C. You can just call them like any other Swift function.

Here’s an example of a very common thing to do with GCD. Dispatch some code to the main thread asynchronously.

        dispatch_async(dispatch_get_main_queue(), {

            println(“I got dispatched!”)


The call looks very similar to what you do in Objective-C. The only different is that you don’t need the block (^) syntax required by Objective-C. You can even make it a little prettier in Swift by using the trailing closer syntax since the last argument is a closure.

        dispatch_async(dispatch_get_main_queue()) {

            println(“I got dispatched!”)




Swift: Selectors

Its very easy to use selectors in Swift. In Objective-C you would pass a selector to a method by using @selector(methodName). In Swift all you have to do is pass the method name as a string.


NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: “onTimer”, userInfo: nil, repeats: true)

This will call the onTimer function of self once per second.


Welcome to the New and Improved Software Logix Site!

I’m a software architect and developer with 25 years of experience from embedded to high performance server to UI and lately mobile development on iOS and Android.

You can get information about my Apps (OmniSketch, CubeScape, AcoustiGrid and Emotage) here.

I’ll be posting information on software development most likely focused on mobile application development on various platforms.