Knowing the UV index before heading outside only tells you part of the story. I built a shortcut for iPhone and iPad that estimates how much UV radiation exposure adds up during outdoor activities.

My colleague Wesley Hilliard has been on a mission to fill as many data categories in Apple Health as possible using apps and automation. Logging the UV index proved particularly challenging without sharing personal information with a third-party app.

Wes eventually built an automation that records the current UV index whenever he starts an outdoor workout. Apple Health receives the measurement, but the automation doesn't account for how long he's been outside.

I wanted to see if Shortcuts could take exposure duration into account. It was also a good opportunity to experiment with the persistent storage features Apple introduced in iOS 27 and iPadOS 27.

My shortcut, called Track UV Exposure, saves individual UV index readings in Apple Health and maintains a history of estimated radiation doses within Shortcuts. You don't need an Apple Watch, specialized sensors, or third-party apps.

How to track UV exposure on iPhone and iPad

I've added comments throughout the shortcut explaining what the actions do and why they're necessary. You can change how the shortcut works or use it as a reference when building your own automations.

You'll need an iPhone running iOS 27 or an iPad running iPadOS 27. Shortcuts may ask for permission to access your location, write data to Apple Health, and save exported files.

  1. Run Track UV Exposure before beginning an outdoor activity.
  2. Select Begin Outdoor Activity.
  3. Run the shortcut again when you've finished.
  4. Select End Outdoor Activity.

The two menu options tell the shortcut when you've started and finished spending time outdoors. When you finish, a notification displays your estimated radiation dose.

You'll find the individual UV index readings under Other Data in Apple Health. Selecting View Exposure History lets you review completed sessions directly from the shortcut, and you can also export your records for use in a spreadsheet.

Tablet screen displaying a health or exposure tracking app, with a pop-up menu listing activity phases like begin or end outdoor activity, view exposure history, and export exposure historyRun Track UV Exposure before beginning an outdoor activity

Be sure to end the session as soon as you finish your activity. If you forget and run the shortcut several hours later, it will count the extra time toward your estimated exposure.

Measuring more than the UV index

The UV index tells you how intense ultraviolet radiation is and takes into account its ability to cause sunburn. Checking the UV index in Weather before going for a walk is useful, but spending more time outdoors means potentially accumulating more radiation exposure.

For example, spending an hour outside under a constant UV index of 3 results in the same ambient radiation dose as spending half an hour under a UV index of 6. The radiation is twice as intense in the second scenario, but you're exposed to it for half as long.

Scientists measure cumulative UV exposure in standard erythema doses (SED). According to the International Agency for Research on Cancer, one SED equals 100 joules per square meter of ultraviolet radiation weighted by its ability to cause skin reddening.

Think of the UV index as a measure of intensity and SED as a measure of how much radiation has accumulated over time. The difference makes it possible to compare outdoor activities of different lengths.

My shortcut estimates ambient radiation rather than measuring how much reaches your skin. It doesn't know whether you're wearing sunscreen, sitting in the shade, or covering your skin with clothing.

Apple added support for UV exposure to HealthKit in iOS 9. Developers can record UV index measurements over time, but Apple doesn't provide a dedicated measurement for cumulative radiation doses in SED.

Building a shortcut that remembers your workout

I started with a Choose from Menu action to give users two options for starting and ending a session. Keeping everything in one shortcut makes it easier to use, but there's a problem with how Shortcuts normally handles information.

Ordinary variables lose their values once a shortcut finishes running. If you record the UV index and start time before a walk, the shortcut won't remember either value when you run it again an hour later.

Apple demonstrated its new storage actions at WWDC 2026. Shortcuts can now save information for future runs without relying on a third-party app or creating a separate file.

Shortcuts uses names called storage keys to retrieve saved information later. Persistent storage supports data types including dates, numbers, and lists, and saved values can sync across devices through iCloud.

Tablet screen displaying a health or research app, showing text instructions, activity options with colored icons, and a side panel containing code-like data fields and a toggle switchShortcuts uses names called storage keys to retrieve saved information later

When you select Begin Outdoor Activity, the shortcut captures the current date and time and retrieves the local UV index from Weather. Two Store Content actions save the information under separate keys.

  • uv_start_date stores the starting date and time.
  • uv_start_index stores the starting UV index.

A Log Health Sample action records the starting UV index and its timestamp in Apple Health. Selecting End Outdoor Activity retrieves both stored values, checks Weather for the latest UV index, and captures the current date and time.

Before doing any math, the shortcut checks that it has all the information it needs. It also makes sure the ending time comes after the starting time so it doesn't calculate a negative workout duration.

A UV index of zero is still a valid reading. The shortcut checks whether Weather returned a measurement without requiring the value to be greater than zero.

Calculating cumulative UV exposure

The shortcut needs to know how long you were outside and how strong the UV radiation was during that time. A Get Time Between Dates action calculates how many seconds passed between the start and end of your activity.

Since there are 3,600 seconds in an hour, the shortcut divides the elapsed time by 3,600 to convert the duration into hours. It then adds the starting and ending UV index readings together and divides the sum by two to find the average.

If the UV index was 4 when you started and 6 when you finished, the average would be 5. The shortcut uses that rough estimate of UV intensity and the activity duration to calculate the radiation dose using the following formula.

0.9 ? Average UV Index ? Elapsed Hours

The number 0.9 comes from how scientists define the UV index and standard erythema dose. Each point on the UV index represents 0.025 watts per square meter of ultraviolet radiation weighted by its ability to cause sunburn.

Multiplying 0.025 by the 3,600 seconds in an hour gives us 90 joules per square meter. Dividing by 100, the number of joules per square meter in one SED, gives us 0.9.

In practical terms, spending an hour outside under a constant UV index of 1 results in an ambient radiation dose of 0.9 SED. A 30-minute workout under a constant UV index of 6 would result in 2.7 SED.

Storing your UV exposure history

After watching Apple's WWDC presentation on Shortcuts storage, I realized I could keep the entire exposure history within the shortcut. Apple demonstrated how an automation could retrieve a list of previously generated facts, add another fact to the list, and save it for future runs.

I applied the same approach to UV exposure tracking using a combination of dictionaries and lists. A dictionary groups related pieces of information under named keys, much like a spreadsheet row with labeled columns.

Each completed session creates a dictionary containing six pieces of information.

  • Activity ending date and time
  • Activity duration in hours
  • Starting UV index
  • Ending UV index
  • Average UV index
  • Estimated radiation dose in SED

The shortcut retrieves the existing exposure history, adds the new dictionary to the list, and saves the updated list in persistent storage. Each dictionary represents a separate session, so adding another record doesn't replace the previous one.

A separate menu option retrieves the stored history and formats the information for easier reading. I also kept the option to export the records as a CSV file for anyone who wants to analyze their exposure in Numbers or Excel.

Back in the End Outdoor Activity section, a second Log Health Sample action saves the ending UV index in Apple Health. Two Delete Stored Content actions then erase the starting date and UV index without affecting the exposure history.

Removing the temporary information prevents the shortcut from accidentally reusing data from a completed session. A Show Notification action finishes the process by displaying the estimated radiation dose.

Debugging the shortcut

Getting information from Weather into Apple Health was fairly straightforward. Getting Shortcuts to remember the correct time took considerably more work.

My original design stored the starting date and UV index together as a single piece of text, separated by a semicolon. At the end of an activity, the shortcut separated the two values and attempted to turn the text back into a usable date.

An early test produced a negative workout duration and a negative radiation dose. Another test lasting approximately 42 minutes produced a recorded duration of more than two hours.

Subtracting the recorded duration from the ending time suggested Shortcuts was interpreting the starting time as noon, even though I'd started the session more than an hour later.

Tablet screen displaying a UV exposure history document in a centered pop-up window, with text details listed and a workflow automation interface visible blurred in the backgroundIf you walk, run, or cycle regularly, you could use the shortcut to compare estimated UV exposure from morning and afternoon activities.

I stored the starting date and UV index separately so Shortcuts could retrieve both values without reconstructing the date from text. After reconnecting the Apple Health actions on my iPad, I ran several more tests to confirm the duration and radiation dose calculations were correct.

A successful test on November 27 lasted five minutes and 23 seconds. During the session, Weather reported a drop in the UV index from 1 to 0.

The shortcut correctly calculated an average UV index of 0.5 and an estimated radiation dose of approximately 0.0404 SED. Both UV index readings appeared in Apple Health, and the original CSV log contained the correct duration and dose.

I also tried ending the session a second time without starting a new one. Shortcuts displayed a notification about missing or incomplete session data, confirming that it wasn't reusing information from the previous activity.

On November 29, I tested the revised version with persistent exposure history. Two separate sessions lasting three minutes and five seconds and six minutes and 53 seconds confirmed that the shortcut could retain multiple records without overwriting earlier entries.

Both sessions had a UV index of zero, giving me another opportunity to verify that the shortcut could save zero values. The stored history contained the correct durations and radiation dose calculations.

The initial history viewer displayed the records as raw JSON, a format that's useful for software but difficult to read at a glance. I added formatting to make the measurements easier to understand and successfully tested exporting the stored records as a CSV file.

What you can learn from UV exposure data

If you walk, run, or cycle regularly, you could use the shortcut to compare estimated UV exposure from morning and afternoon activities. You might also notice substantial differences between otherwise identical workouts in summer and winter.

Exporting your exposure history to Numbers lets you add up the estimated radiation doses from multiple outdoor activities. You can create charts to examine how your exposure changes throughout the year or compare weekly and monthly totals.

For someone who likes taking an hour-long walk every day, the information could help identify a time of day with lower UV exposure without shortening the walk.

You'll still need to follow established sun protection guidance. The World Health Organization recommends protection when the UV index reaches 3 or higher.

The shortcut only checks the UV index twice, so it can miss changes in radiation intensity between readings. Passing clouds, for example, can affect UV levels during an activity without either reading capturing the change.

Don't use the calculated dose to predict sunburn, determine how long it's safe to stay outside, or estimate your individual risk of skin cancer.

I'd like to see Apple build cumulative UV radiation tracking directly into Health. The Apple Watch can already record workouts and measure time outdoors in daylight, giving Apple a potential foundation for more automated tracking.

What started as an attempt to fill an overlooked category in Apple Health became an experiment in building a more capable tracking tool with Shortcuts. Apple's persistent storage features let me collect, retain, review, and export information without needing a third-party app.