Skip to content

Instantly share code, notes, and snippets.

@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_sharing_data_apple_watch.md
Last active March 28, 2016 15:49
Sharing Data apple watch

Sharing Data between Apple Watch and iPhone Apps

Introduction

So we've had a look at how we can do a lot of things with the WatchKit SDK and making our own Apple Watch Apps, however the next thing to look at is how to communicate between the iPhone and Apple Watch app. To do this we'll have to create an App Group which is essentially a space which both apps can use which was brought in with the exetension framework.

Add Capabilities

The first thing we need to do is add "App Group" capabilities to both our iPhone app and Watch Extension targets.

@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 / watchkit_multiple_row_types.md
Last active November 25, 2018 02:57
How to Add Multiple Row Types in an Apple Watch Table

#How to Add Multiple Row Types in an Apple Watch Table

Since we've got our project set up one of the first interface items you might be using is a table. There are a lot of blog posts on how to get started with tables however one of the things we wanted to do with Whiskr was to use multiple types of rows in a single table e.g. we have a loading row, a heading row, and a content row. This blog will help you use several types of rows in your app too!

Imgur

a heading, and content row as displayed in our Whiskr app

##1. Interface Builder

Firstly, we want to open the Apple App Storyboard (found in the WatchKit App folder). You should have an interface controller with a table in it. To create different types of rows you need to add more rows by selecting the table and in the inspector increase the number of rows. This will g

@daniellevass
daniellevass / starting_library_project_AS.md
Last active August 30, 2020 00:48
Getting Started with a library project in Android Studio

Getting Started with a library project in Android Studio

So we're working on creating Android Material Awesome, a library which will hopefully incorperate the benefits of Material Design, Twitter's Bootstrap, and FontAwesome. What we really wanted is a project other people can easily include into their projects using gradle dependencies. To do this we needed to create a standalone library project so we could make it as lightweight as possible for including as a dependency, and a sample app that would use it for testing. These are the steps we took to get started in Android Studio (version 1.1).

Create Projects

The first thing we needed to do was to create two new projects, with all the default settings (Blank Activity etc). One for our sample app, and one for our library. We added both of ours into the same GitHub repo, however you can save them wherever you like.

Fix Up Library Project

@daniellevass
daniellevass / context_menus_and_modals.md
Last active October 26, 2015 23:29
Making Context Menus and Modal Dialogs in Apple Watch Apps

#Making Context Menus and Modal Dialogs in an Apple Watch App

Another learning curve we faced when creating the Whiskr Apple Watch App was how to use a context menu with modal dialogs. We ideally wanted this menu to display when the user force touched (long press) on a cat picture, so they could chose between showing where the picture was taken on a map, or display additional information about the picture, for example who took it.

Imgur

the context menu inside the Whiskr app when you force press on a photograph.

##1. Context Menu

The first thing we needed to do was to open our storyboard. We need to drag a "menu" object out onto the Interface Controller that the user will force touch on. It's worth noting here, that a context menu is unique only to a screen, you can not make it unique for each item in a table row for example.

@daniellevass
daniellevass / sharing_data_ios.md
Last active September 21, 2022 23:06
Sharing Data between iPhone and Apple Watch apps

#Sharing Data between iPhone and Apple Watch apps

So we've already taken a look at some of the issues we've faced building our Whiskr Apple Watch app, next we're going to look into how we shared data between the iPhone and Apple Watch app. This was probably one of the hardest aspects to learn and get right, and the current documentation isn't all that great!

To do this we'll have to create an App Group which is essentially a space which both apps can use. It was brought in with the exetension framework in iOS8 so apps can communicate with their Today widgets, or custom keyboards, and amongst other applications.

Add Capabilities

The first thing we have to do is add the app group capability to both our iPhone and Watch Watch Extension targets.

@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