PodPower — How It Works

Andreas Ink
3 min readMar 13, 2022

--

Introduction

Hey! I just launched PodPower, an app that improves posture, encourages more workouts, and fosters better hydration using the AirPods motion sensor.

Technical Approach

I want to take the time to approach a few technical things I learned from coding PodPower, including using SwiftUI, CoreMotion, GameKit, and the overall approach to measuring posture, workout reps, and drink consumption.

SwiftUI…

With this project, I decided to go with a new, cleaner route for data persistency, a property wrapper…

The approach is to use a property wrapper to save codeable data, also it is heavily inspired by this article…

https://www.jessesquires.com/blog/2021/03/26/a-better-approach-to-writing-a-userdefaults-property-wrapper/

Feel free to show the author of that article some love :)

CoreMotion…

Weird side note before I dive into CoreMotion, when combining CoreMotion and SceneKit, there is a weird memory leak that forced me to disable my favorite feature, so if anyone has a solution to this, I’ll throw in a free Power Pack for PodPower, just hit me up @AndreasInk on Twitter.

Here’s the core aspect of CoreMotion as I used it…

Ideally, for a cleaner approach, use this…

APP.startDeviceMotionUpdates(to: OperationQueue.main ?? .main) { [unowned self] (motion, error) in

However, I’m not an expert in CoreMotion so take this with a grain of salt, but I went with a timer to try to fix the memory leak, but it did not work and I just kept the other code block.

GameKit…

To authenticate the user I used this code block (original source below)

https://stackoverflow.com/questions/58722084/how-to-display-game-center-leaderboard-with-swiftui

This code block was also used to update scores given a user (usually .local)

Core Functionality…

Detecting posture, reps, and drink consumption was a bit difficult, I originally used CreateML to create machine learning models to detect this but ultimately this wasn’t the best solution. Then I realized that another app I’m developing is surprisingly useful for detecting posture, drinking, and workout reps…

A finite state machine, essentially a series of conditional statements that work on a level system based on averages, the median of averages, and a certain threshold. Using this I can detect outliers such as a change in overall motion that I can then classify as bad posture, a pushup (or squat, sit-up, lunge), or drink consumption.

UI/UX Approach

I did my best to listen to every peice of feedback I received (missed one, forgot to configure HealthKit for water logging, that update is on its way!), and I think that’s core to UI/UX, simply listening to others. Unlike any other app I’ve developed, I put a huge emphasis on making the app as easy to use as possible, keeping it minimalistic and really focusing on the onboarding and having many question mark buttons to increase usability.

Business Approach

I decided that I wanted to take a more business approach to this app so I can continue to make more apps, so I decided to promote the premium version, the Power Pack, by limiting usage per day for non-premium users and adding more features for premium users, I debated if this was the right route but I hope its the right decision and fair for everyone. If you have any thoughts on this feel free to let me know as this is the first time I’ve really tried to monitize an app.

If you learned something or enjoyed the article, please check out PodPower to support me as a dev and as a student :)

https://apps.apple.com/us/app/podpower/id1606864098

--

--

Andreas Ink
Andreas Ink

Written by Andreas Ink

Sharing what I'm learning...

No responses yet