Bird
0
0

Which of the following is the correct syntax to add pull-to-refresh to a SwiftUI List?

easy📝 Syntax Q12 of 15
iOS Swift - Lists and Data Display
Which of the following is the correct syntax to add pull-to-refresh to a SwiftUI List?
AList { ... }.refreshable { await loadData() }
BList { ... }.onRefresh { loadData() }
CList { ... }.refresh { loadData() }
DList { ... }.pullToRefresh { await loadData() }
Step-by-Step Solution
Solution:
  1. Step 1: Recall the official SwiftUI modifier for pull-to-refresh

    The correct modifier is .refreshable with an async closure.
  2. Step 2: Match syntax with options

    List { ... }.refreshable { await loadData() } uses .refreshable { await loadData() } which is correct syntax.
  3. Final Answer:

    List { ... }.refreshable { await loadData() } -> Option A
  4. Quick Check:

    Correct modifier = .refreshable [OK]
Quick Trick: Use .refreshable with async closure for pull-to-refresh [OK]
Common Mistakes:
  • Using .onRefresh instead of .refreshable
  • Missing await keyword in async closure
  • Using non-existent modifiers like .pullToRefresh

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes