Automating my Bedroom with HomeKit

I’ve been wanting to play with HomeKit for a few months but I never actually bought any HomeKit compatible device until a few weeks ago. I wanted to start slow and see how HomeKit has improved over the last iOS versions.
I am completely new to this @internetofshit thing, so here are my thoughts! šŸ˜„

More …

Playground in Xcode 8

During session 213 of WWDC 2016, some changes to Playground in Xcode 8 were mentioned. The talk shows more tips and tricks to make use of the powerful Xcode features such as Assets Catalogs to avoid writing more code than what is necessary. I highly reccomend you to watch it!

To manage the execution of a Playground, the PlaygroundSupport framework can now be used. By ⌘ + clicking the framework name, this is what you can find:

  • A UIViewController and UIView extension that implement the PlaygroundLiveViewable protocol.
  • The PlaygroundLiveViewRepresentation enum which describes if the current live view shows a UIView or a UIViewController.
  • The PlaygroundLiveViewable protocol itself that has a variable to hold the current live view representation.
  • The PlaygroundPage class that allows you to modify the playground execution.

A Playground is compiled like a script, line after line. This is great until you want to test a network request that is performed asynchronously. You will never see the callback result because the Playground is simply stopped before the response can arrive. To fix this problem you have to tell Xcode that your page needsIndefiniteExecution. Let’s take a look at a common URLSession usage.

More …

Implement a UITableView in RxSwift

RxSwift is a reactive programming framework which enables easy composition of asynchronous operations and event/data streams. I’m currently building a Twitter timeline analyzer iOS app called Tweetometer to learn RxSwift. You can check out the code in the repository on Github. In this post I’d like to show how to build a simple UITableView with RxSwift.

Start by creating a new iOS project and set the language to Swift. You now have to install the RxSwift framework. Follow the instructions in the official repository to install it with CocoaPods or Carthage. If you choose CocoaPods, this is what your Podfile should look like.

use_frameworks!


      

      
        
        
        

        
          More …