Git Product home page Git Product logo

watchtoys's Introduction

WatchToys

Eventually, this will be a collection of complications for the Apple Watch. For now, it's just one complication (a step counter).

Steps Complication

This is a simple complication that retrieves the number of steps the user has taken today from HealthKit and displays the count in a complication. You must authorize this app to access your HealthKit data (only your step count!), and you can do that with a convenient button in the application on the watch itself. To see real step data, you must install and run this app on a real Apple Watch.

To Run

Before you start, note that, when run in the Apple Watch simulators in Xcode, you will never see real or useful data in this complication (there is no mocked step data in the simulator).

  1. Download and install Xcode.
  2. Open this project and run it in the simulator using the Play button at the top of the application.
  3. When the simulator appears, wait for the main app view to load. It should prompt you to authorize access to HealthKit data.
  4. Click the Authorize button and wait for the HealthKit authorization sheet to show up.
  5. Click the Review button and wait for the second authorization sheet to load.
  6. Toggle the Steps datum and scroll down, then click the Done button.
  7. Use the digital crown button (top right button on the side of the simulator) to return to the watch face home screen (it looks like a watch face).
  8. Long-click on the watch face to bring up the watch face designer (this will look like the watch face moving away from you).
  9. Click and drag the screen from right to left to move to the New screen.
  10. Click the New button to add a new watch face.
  11. Scroll down to the Solar Dial face and click Add.
  12. Click and drag the screen from right to left to scroll over to the complication editing mode. The four corners around the watch face should have bubbles you can tap on to edit the complication that lives there.
  13. Click on any complication.
  14. Scroll down to the WatchToys complications and click the Steps complication.
  15. You will be returned to the complication editing mode, but now the complication you edited should have the Steps complication's preview text in it (1524 STEPS).
  16. Use the digital crown button (top right button on the side of the simulator) twice to accept your changes and then to return to the watch face home screen.
  17. Now, the Steps complication should be working for you in the new watch face you made.

watchtoys's People

Contributors

millerti avatar

Watchers

 avatar

watchtoys's Issues

Create a "Bones Day" complication

Create a complication that displays whether today is a Bones Day or a No Bones Day, as per Noodle the pug on TikTok.

This will probably require a solution to the update timing issue since the author of these videos only updates once a day (so the complication might be stuck in an "I don't know" state for most of the day, making it pretty useless).

Make main app UI more representative of authorization state

Right now, the Authorize button in the app (the one that launches the HealthKit permissions sheets) does not go away when the user provides approval (so you land right back at the main app screen with the Authorize button still there, as if you had not just provided access).

This is obviously confusing. I am not sure about how to fix the problem.

I could make the button and UI change if the user successfully provided access. However, this can only happen the first time the user provides access since the HealthKit API will not allow me to query whether access has been provided (for privacy reasons). In other words, I could fix the primary workflow, but if the user ever re-opens the app, the issue would be back. Since people are likely not using this app more than once, maybe that's good enough.

I could also look into ways I could store off whether permission was given, then respect that. But that's not ideal because the user can add or remove permission at any time in the Settings apps.

I'm not sure what to do about this yet.

Complications update too infrequently

Leaving the step count update timing to watchOS means steps only get updated once every few hours. Obviously, this isn't ideal, and it could preclude me from making other complications that depend on checking data updated infrequently.

Possible solutions:

  • Is there a way to "subscribe" to HealthKit datum updates?
  • Could I write a background app that runs on the paired iPhone that pushes updates to the watch when they happen?
  • Another site mentioned that the CoreMotion API might be a better way to detect the step count. Maybe it's worth investigating the differences.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.