Type Safely

Type Safely

Share this post

Type Safely
Type Safely
Calling a RefreshAction From Custom Views That Can't Use .refreshable

Calling a RefreshAction From Custom Views That Can't Use .refreshable

Daily Coding Tip 126

Millie Sturgeon's avatar
Millie Sturgeon
Jul 07, 2022
∙ Paid

Share this post

Type Safely
Type Safely
Calling a RefreshAction From Custom Views That Can't Use .refreshable
Share
Image by Kevin Schmid from Pixabay

Tested on Xcode Version 14.0 beta 2 (14A5229c).

There’s a .refreshable modifier that I can call on a List, but I can’t use it everywhere.

An environment variable is available to views that don’t have access to it, and it looks like this:

@Environment(\.refresh) var refreshAction: RefreshAction?

Here’s a simple Button that …

Keep reading with a 7-day free trial

Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Type Safely
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share