◉RORK LABJP
●EXPO — EAS Observe now records native crashes (Oct 7). On SDK 57, update to 57.0.21 or later●SDK 58 — SDK 58 Beta has been out since Sep 15. The stable date is still unconfirmed●RN 0.88 — React Native 0.88.x is scheduled for Oct 12, 3 days left●Q&A — People are asking why expo-widgets render blank only in production builds●RORK — GPT-6.1 Sol was added on Sep 29, available on Pro and Max plans●NEW — Building an app for a client? Decide who owns the publishing account first●EXPO — EAS Observe now records native crashes (Oct 7). On SDK 57, update to 57.0.21 or later●SDK 58 — SDK 58 Beta has been out since Sep 15. The stable date is still unconfirmed●RN 0.88 — React Native 0.88.x is scheduled for Oct 12, 3 days left●Q&A — People are asking why expo-widgets render blank only in production builds●RORK — GPT-6.1 Sol was added on Sep 29, available on Pro and Max plans●NEW — Building an app for a client? Decide who owns the publishing account first
Articles/Dev Tools
⬡ Dev Tools/2026-06-24Advanced

Quietly Dialing Back Heavy Work When the Device Gets Hot or Enters Low Power Mode

How to watch ProcessInfo's thermalState and Low Power Mode and degrade heavy work in stages when the device is hot or the battery is low, with working Swift code.

Rork Max235SwiftUI66Performance25BatteryOn-Device AI6

✦ Premium Article

After I added an on-device AI feature to an app I have maintained for years as an indie developer, reviews started arriving a few days post-release: "the phone gets hot while I use it," "the battery drains fast." It never reproduced on my test device, and the cause eluded me for a while. What I eventually realized was that my testing always happened in the best possible conditions — a cool room and a full charge.

Real users open the app outdoors in summer, or on a crowded commuter train with the battery in single digits. There, iOS itself has already started capping the CPU and GPU, and my app, by trying to run heavy work at full tilt, was making the heat and the battery drain worse. The app needed to read the device's state and back off on its own.

This article walks through monitoring the two states that ProcessInfo exposes — the thermal stage (thermalState) and Low Power Mode (isLowPowerModeEnabled) — and degrading heavy work in stages, in a form you can drop straight into the native Swift that Rork Max generates.

Treat heat and low power as separate signals

The first thing to settle is that these two have different causes and different remedies. Collapse them into one flag and you will make the wrong call.

Thermal state represents the device physically heating up while the OS starts throttling. It has four stages — .nominal, .fair, .serious, .critical — and from .serious onward the OS throttles aggressively. If the app keeps running heavy work there, the felt experience collapses quickly.

Low Power Mode is a setting the user chooses, or the system enables automatically as charge drops, to conserve battery. It happens independently of heat. Here, remedies that cut power directly — holding off on background refresh, lowering network frequency — are what work.

So heat calls for "make what is running right now lighter," while low power calls for "do less from here on." Answering each from a different drawer is the design that fits.

Monitor thermalState and define stages

ProcessInfo lets you read the current thermal stage synchronously and also posts a notification when it changes. Receive that notification in one place and convert it into state the whole app can read.

import Foundation
import Combine
 
@MainActor
final class DeviceConditionMonitor: ObservableObject {
    @Published private(set) var thermalState: ProcessInfo.ThermalState
    @Published private(set) var isLowPower: Bool
 
    init() {
        let info = ProcessInfo.processInfo
        thermalState = info.thermalState
        isLowPower = info.isLowPowerModeEnabled
 
        NotificationCenter.default.addObserver(
            self, selector: #selector(thermalChanged),
            name: ProcessInfo.thermalStateDidChangeNotification, object: nil)
 
        NotificationCenter.default.addObserver(
            self, selector: #selector(powerChanged),
            name: .NSProcessInfoPowerStateDidChange, object: nil)
    }
 
    @objc private func thermalChanged() {
        let next = ProcessInfo.processInfo.thermalState
        Task { @MainActor in self.thermalState = next }
    }
 
    @objc private func powerChanged() {
        let next = ProcessInfo.processInfo.isLowPowerModeEnabled
        Task { @MainActor in self.isLowPower = next }
    }
}

The notifications can arrive on any thread, so I re-receive them on @MainActor to stay consistent with UI state updates. If the code Rork Max generated does not already subscribe to these notifications, start by placing this single monitor — every later decision can then funnel through it.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦You can monitor ProcessInfo's thermalState and isLowPowerModeEnabled to wind down expensive work in stages as the device heats up or saves power
✦You'll fold animations, background refresh, and on-device inference into a single quality tier, so you soften the experience instead of breaking features
✦You'll learn how to protect battery and thermals without inconveniencing the user, for an app that holds up over the long run
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-07-18
The Generated Screen That Quietly Jams at AX5 and in German — Putting Layout Resilience Checks on Rork Max SwiftUI
A record of running every Rork Max generated SwiftUI screen through pseudolocalization and the largest text size to find exactly where it jams. Covers when to reach for ViewThatFits, ScaledMetric and layoutPriority, plus the snapshot checks that catch regressions every time you regenerate.
⬡ Dev Tools2026-05-17
Testing Rork Max SwiftUI Features on a Real Wallpaper App — What Worked, What Needed Fixes
I benchmarked Rork Max's SwiftUI generation against the production code of a wallpaper app I actually run. Here is what shipped as-is, what needed fixing, and what I ended up writing by hand — with working code and on-device measurements.
⬡ Dev Tools2026-05-12
Building a Shared UI Component Library with Swift Package Manager in Rork Max
A practical guide to building a shared SwiftUI component library with Swift Package Manager for indie developers running multiple apps — eliminate duplicate code across wallpaper, healing, and similar app families.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links