Natasha The Robot

Currently learning... Swift!

You can follow me on Twitter here.

Subscribe via RSS here.

Subscribe to my Swift newsletter

WatchKit: How to Place Text Over An (Animating) Image

It is becoming common to see WatchKit UI that includes a chart-like animating image with text overlaid on top of it. Yet, today when I tried to create this type of interface, I got stuck. I couldn't put a Label on top of an Image!

WatchKit UI: A Clever Passcode Screen

Love this clever Passcode entry interface from 1Passcode's Apple Watch App.

WatchKit: How to Check Device Screen Size in Code

The Apple Watch comes in two sizes – the 38mm and the 42mm. This means that you might need to do different logic based on the device screen size in code. In my case, I wanted to set a different image based on the device size. So here is how you check the Apple Watch device size in code...

Swift: The Unused Optional Value Problem

Yesterday, I had an interesting discussion involving Swift optionals with my co-workers. Here is a scenario - you need to do something in your code based on whether an optional value exists or not, but the thing you need to do does not need to actually use the optional.

Open Source Apps

One of the very exciting trends I've been seeing recently is the open sourcing of actual iOS/OSX apps...

Swift: Putting Your Generics in a Box

One of my favorite functional patterns that I now use in Swift is the Result enum for error handling... but it doesn't actually work.

WatchKit: The Text Input and Dictation API is Available!

I've looked into it some more, and voila, the text input API is in fact available for everyone to use. Of course it is not fully useable yet in the current simulator, but there is an API for it. I created a simple Interface Controller with a button that will bring up the text input controller using this code...

WatchKit Data Sharing: Beware of the NSFileCoordinator and NSFilePresenter

One of the biggest challenges of working with WatchKit is figuring out how to best share information between your iOS and WatchKit app. While NSFileCoordinator and NSFilePresenter sounded perfect for the task, I learned that there are big issues with using these APIs...

Mutating Functions in Swift Structs

I’ve started working a lot more with Swift Structs, especially as I’m learning more about functional programming. I remember when Swift first came out, I was super confused about why the compiler made me insert the “mutating” keyword for my functions in structs. However, now after reading a bunch about value vs reference types, it’s starting to make a lot of sense.

Unit Testing in Swift: A Quick Look at Quick

A few days ago, I wrote about how to do dependency injection in Swift using the default XCTest framework. However, I’ve actually been working a lot with Quick to do my unit testing in Swift. So today, I want to walk through how to write some ViewController tests with Quick...