Skip to content

Instantly share code, notes, and snippets.

@daniellevass
daniellevass / getting_started.md
Last active August 29, 2015 14:14
Getting Started with Apple's WatchKit

#Getting Started with Apple's WatchKit

###Introduction This is the first post about how we built Whiskr, the Apple Watch to see pictures of cats taken close to you. The aim is to demonstrate more of the trickier features of WatchKit and help people get their own Apple Watch apps launched. This first post is about how to get started, what tools you need and how to set up your project.

###1. XCode and WatchKit

Make sure you have XCode 6.2 which comes with the WatchKit SDK, available at https://developer.apple.com/xcode/downloads/

It's also worth taking the time to check out the following guides:

compile 'com.squareup.okhttp:okhttp:2.2.0'

<uses-permission android:name="android.permission.INTERNET" />

private final OkHttpClient client= new OkHttpClient();

public void sendRequest() {
        Request request = new Request.Builder()
 .url("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22Bath%2C%20England%22)&amp;format=json&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys")
@daniellevass
daniellevass / paged_apps.md
Last active August 29, 2015 14:14
Paged Apple Watch Apps

Paged Apple Watch Apps

##Introduction

Last time we had a look at how to create a hierarchical app using tables and push segues. This time we're going to take a brief look at the alternate navigation by creating a paged app.

##Interface Builder

We can actually achieve a paged app with just the interface builder. The first thing to do is drag out a single Interface Controller and set the background to a red colour. Next we need to move the Main Entry point from the hierarchical app to point to this new Interface Controller.

@daniellevass
daniellevass / 0_context_apps.md
Last active August 29, 2015 14:14
Context Menus and Dialogs Apple Watch Apps

#Context Menus and Modal Dialogs in Apple Watch Apps

##Introduction

So now we've taken a look at how to create both hierarchical and paged apps, we can begin to look at some of the more exciting new features inside the WatchKit SDK such as context menus, modal dialogs, and map views.

###Context Menus

It doesn't matter which style of navigation you want to use, context menu's can be added to either. These are up to 4 options that users can do on any given screen, for example order a list alphabetically.

@daniellevass
daniellevass / 0_glances_apple_watch.md
Last active August 29, 2015 14:14
Glances in Apple Watch

Glances in Apple Watch

Introduction

So last time we learned how to synchronise data between our iPhone and Watch app, this week we're going to look at using that to set up glances. Glances enable us to display timely and relevant data to our users, for our example we're going to show the user whatever colour they were last looking at on the iPhone app.

The official documentation for glances suggests using timers to periodically update the data the glance is displaying. How often your app checks for updates is up to you however, I wouldn't do it too often or the user might uninstall your app for consuming too much battery power.

Running Glances

Firstly, we need to tell our emulator to run the "glances" mode and not the proper Apple Watch App. To do this click on the target for the emulator (bit to the left of which device your going to run on) and press edit scheme.

@daniellevass
daniellevass / apple_watch_cant.md
Last active August 29, 2015 14:16
what you can't do in apple watch

#What you can’t do with Apple Watch

Last time we covered what you can do with the Apple Watch, but of course, there are limitations to what we’ll be able to do as developers. Here, we’ll be looking at some aspects of the current Apple WatchKit API that make certain things not possible (at least with the first generation device).

Note: This post goes into a bit more technical detail

##Sensors

One of the major limitations of the WatchKit API, is the inability to access any of the sensor data - so we won’t be able to access the new heart rate sensor, accelerometer, or gyroscope. This could simply be because an actual device hasn’t been made yet, so the behaviour isn’t set in stone and an API hasn’t been created. Also, as there isn’t an actual device for developers to purchase, there would be absolutely no way to test if any of our sensor code actually worked.

@daniellevass
daniellevass / glances.md
Last active August 29, 2015 14:18
Making use of Glances in an Apple Watch App

#Making Use of Glances in Apple Watch Apps

Finally in our Apple Watch App explorations, one of the features we really wanted to try out was glances. These allow people a "quick look" at some important information. In Whiskr we wanted people to be able to see the picture they last looked at quickly again. Maybe to help people check if a cat in front of them matches the one they saw on their screen.

iPhone App

To get started with glances, we need to save the last image viewed. We will need to use the information from this blog on how to save data between iPhone and Apple Watch app using User Preferences.

Apple Watch App

@daniellevass
daniellevass / 1.md
Last active August 29, 2015 14:18
IoT Hack day
@daniellevass
daniellevass / 1.md
Last active August 29, 2015 14:26
BRLSI app
@daniellevass
daniellevass / article.md
Last active August 29, 2015 14:26
Bath YRS FoC 2015 projects

Bath Young Rewired State Festival of Code 2015

The Young Rewired State run an event each year called the festival of code - where kids under 18 get to build anything they want (but must contain some open data) and showcase it at the end of the week with all the other centers. This year the weekend was hosted in Birmingham and we had three teams presenting.

This is a run down of the things that they made!

Max - aged 13 - LittleBits Bath PollutionBits

Imgur

Max made a node.js program that connected with the Bath pollution data and displayed two different sensor locations and the average pollution for Bath using littlebits. Littlebits are like lego for programming. One of the bits that I have are cloudbits - whereby we can program them over the Internet. The first picture below is some of the components that we put in a box for display purposes. This could then be used in schools or public locations to display how polluted our cities r