File tree Expand file tree Collapse file tree 1 file changed +4
-29
lines changed Expand file tree Collapse file tree 1 file changed +4
-29
lines changed Original file line number Diff line number Diff line change @@ -15,35 +15,10 @@ struct TestView: View {
1515 @State private var pageState: PageStates = .loading
1616
1717 var body: some View {
18- NavigationView {
19- ScrollView {
20- ForEach (0 ..< 100 , id : \.self ) { _ in
21- AsyncImage (url : URL (string : " https://picsum.photos/1000" )) { phase in
22- if let image = phase.image {
23- image
24- .resizable ()
25- .scaledToFill ()
26- } else {
27- Color.gray
28- }
29- }.frame (height : 200 , alignment : .center )
30- .clipped ()
31- }
32- }.navigationTitle (" Example Content" )
33- }
34- .modifier (ErrorableViewModifier (pageState : $pageState) { // Like this
35- DefaultErrorView (type : .sheet ) {
36- pageState = .loading
37- DispatchQueue.main .asyncAfter (deadline : .now () + 3 ) {
38- pageState = .successful
39- }
40- }
41- })
42- .onAppear {
43- DispatchQueue.main .asyncAfter (deadline : .now () + 3 ) {
44- pageState = .failure
45- }
46- }
18+ // YOUR CODES
19+ .akErrorView (pageState : $pageState) {
20+ // TRY AGAIN ACTION
21+ }
4722 }
4823}
4924```
You can’t perform that action at this time.
0 commit comments