PodPower — How It Works

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

--

--

--

Hey! I'm Andreas and I'm an 19 year old software developer and university student who's sharing his experience

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Adaptive User Interfaces with UIStackView and UICollectionView

iOS Architectures Explained: Which One Best Fits My Project?

Tips & Tricks gleaned for XCUIApplication Launch Arguments

PencilKit: Building a complete drawing app with a few lines of code

Handling VoIP Push Notifications with CallKit

Swift — Facebook iOS Login SDK

Swift | Protocols

Mocking objects in Swift — fake name, last name or description

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andreas Ink

Andreas Ink

Hey! I'm Andreas and I'm an 19 year old software developer and university student who's sharing his experience

More from Medium

What the heck is instantSearchSDKJSBridgeClearHighlight captured by Sentry?

Dynamic Symmetry

Digiguys Apps Wise Camera Wise Photos Dynamic Symmetry Artistic Composition Rule

Build Game With Flutter

Custom TabView with SwiftUI