-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathState.swift
44 lines (36 loc) · 995 Bytes
/
State.swift
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
37
38
39
40
41
42
43
44
protocol State{
func stateDescription() -> String
func responseToRequest() -> String
}
struct Online:State{
func stateDescription() -> String {
return "オンラインです"
}
func responseToRequest() -> String {
return "今から取得を開始します"
}
}
struct Lording:State{
func stateDescription() -> String {
return "ロード中です"
}
func responseToRequest() -> String {
return "すでにロード中です"
}
}
struct Offline:State{
func stateDescription() -> String {
return "オフラインです"
}
func responseToRequest() -> String {
return "オフライン中なので、ダウンロードできません"
}
}
struct NetworkError:State{
func stateDescription() -> String {
return "ネットワークエラーが発生しました"
}
func responseToRequest() -> String {
return "エラーが発生しました"
}
}