forked from nalexn/clean-architecture-swiftui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErrorView.swift
More file actions
36 lines (32 loc) · 902 Bytes
/
Copy pathErrorView.swift
File metadata and controls
36 lines (32 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// ErrorView.swift
// CountriesSwiftUI
//
// Created by Alexey Naumov on 25.10.2019.
// Copyright © 2019 Alexey Naumov. All rights reserved.
//
import SwiftUI
struct ErrorView: View {
let error: Error
let retryAction: () -> Void
var body: some View {
VStack {
Text("An Error Occured")
.font(.title)
Text(error.localizedDescription)
.font(.callout)
.multilineTextAlignment(.center)
.padding(.bottom, 40).padding()
Button(action: retryAction, label: { Text("Retry").bold() })
}
}
}
#if DEBUG
struct ErrorView_Previews: PreviewProvider {
static var previews: some View {
ErrorView(error: NSError(domain: "", code: 0, userInfo: [
NSLocalizedDescriptionKey: "Something went wrong"]),
retryAction: { })
}
}
#endif