WatchOS 2 tutorial: Activity Ring – WKInterfaceActivityRing

Just a quick example how to use WKInterfaceActivityRing and HKActivitySummary to show Activity Ring.

Simulator Screen Shot Jun 7, 2016, 8.58.27 PM

Go ahead and drag “Activity Ring” on your Interface Controller, use Assistant Editor to add Outlet to your Controller, e.g.

@IBOutlet var activityRing: WKInterfaceActivityRing!

All you need to set up Activity Ring values is to create and initialize HKActivitySummary, here is the sample code (for simplicity we are going to use the same values for all the rings)

let summary = HKActivitySummary()
let value: Double = 2
let goal: Double = 10
 
summary.activeEnergyBurned = HKQuantity(unit: HKUnit.kilocalorieUnit(), doubleValue: value)
summary.activeEnergyBurnedGoal = HKQuantity(unit: HKUnit.kilocalorieUnit(), doubleValue: goal)
 
summary.appleExerciseTime = HKQuantity(unit: HKUnit.minuteUnit(), doubleValue: value)
summary.appleExerciseTimeGoal = HKQuantity(unit: HKUnit.minuteUnit(), doubleValue: goal)
 
summary.appleStandHours = HKQuantity(unit: HKUnit.countUnit(), doubleValue: value)
summary.appleStandHoursGoal = HKQuantity(unit: HKUnit.countUnit(), doubleValue: goal)
 
activityRing.setActivitySummary(summary, animated: true)

That’s pretty much it.

Social Share Toolbar

Some thoughts about html5 by Christian Heilmann

http://www.youtube.com/watch?v=r7xnKSPWTjo – it is really cool presentation for anyone who cares about the web (by Christian Heilmann http://christianheilmann.com/)

P.S. just put here some interesting tools:

Social Share Toolbar

Hackathon – first experience, helpful tips

I have heard about hackathon events in Facebook and Google and about all this hackers culture, that could pass for something for nerds only. I have even experience as an organiser of company’s internal hackathon event. And finally I took part in hackathon
in person with excellent team, and this is beyond words how cool it was. It is the great challenge to create something new, something completely ready for demo, only for 24 hours.
In hackathon you can participate in all phases of the software’s lifecycle only for 24 hours.

Some tips that I discovered for myself:

  • find your team
  • find something like whiteboard and marker
  • come up with some ideas
  • finally choose idea that your team will implement
  • work out the details of minimum working version – all features and improvements MUST be hold over till minimum version will be ready
  • DON’T try to do everything right, I’m about good architecture design and universalism. This is very important point that may save your time. If you can not do something fast enough – hack it. If you have a problem – hack it. This is HACKathon. The result you will show on the demo, so you should hack enough to prepare application for the demo
  • Think about what will take place at the demo
  • It’s obviously, but divide functionality into tasks.
  • It is necessary to monitor progress of each team member. For example we have been working by agile methodology. We used 45 minutes sprints. And after each sprint we got stand up meeting. Then we must rest – 10-20 minutes we had been playing in kicker/kinect/eat something/etc
  • rest is very important point – don’t forget about it
  • Here is our result – https://github.com/DjComandos/MobileRockBand

    Looking forward to the next Hackathon.

    Social Share Toolbar

    Some helpful videos for front-end developers

    Here is the collection of some helpful videos for front-end developers (by Paul Irish) http://delicious.com/paul.irish/frontend+video

    Social Share Toolbar

    Inception

    Just another first post. Seems that it’s finally the latest new blog (2013-…) =)

    Previous blogs could be found here (RU):

    habrahabr.ru/users/djcomandos/topics/ (2010-2013)

    and another one

    djcomandos-nik.livejournal.ru (2009-2012)

    Social Share Toolbar