Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
devmehmetates committed May 16, 2024
2 parents 67802ad + 231ddc1 commit 8f81c0d
Showing 1 changed file with 4 additions and 29 deletions.
33 changes: 4 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,10 @@ struct TestView: View {
@State private var pageState: PageStates = .loading

var body: some View {
NavigationView {
ScrollView {
ForEach(0..<100, id: \.self) { _ in
AsyncImage(url: URL(string: "https://picsum.photos/1000")) { phase in
if let image = phase.image {
image
.resizable()
.scaledToFill()
} else {
Color.gray
}
}.frame(height: 200, alignment: .center)
.clipped()
}
}.navigationTitle("Example Content")
}
.modifier(ErrorableViewModifier(pageState: $pageState) { // Like this
DefaultErrorView(type: .sheet) {
pageState = .loading
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
pageState = .successful
}
}
})
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
pageState = .failure
}
}
// YOUR CODES
.akErrorView(pageState: $pageState) {
// TRY AGAIN ACTION
}
}
}
```
Expand Down

0 comments on commit 8f81c0d

Please sign in to comment.