-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathContentUnavailableView.swift
52 lines (47 loc) · 1.39 KB
/
ContentUnavailableView.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
45
46
47
48
49
50
51
52
//
// ContentView.swift
// ContentUnavailable
//
// Created by Ganesh on 29/06/23.
//
import SwiftUI
struct ContentUnavailableView: View {
@State private var ContentType:Int = 0
var body: some View {
VStack{
Spacer()
Picker("Content", selection: $ContentType) {
Text("Search").tag(0)
Text("Mail").tag(1)
Text("Favourite").tag(2)
Text("Weather").tag(3)
}
.pickerStyle(.segmented)
switch ContentType{
case 0:
ContentUnavailableView.search
case 1:
ContentUnavailableView("No mails", systemImage: "tray.fill")
case 2:
ContentUnavailableView("No favourites",systemImage: "star")
.symbolVariant(.slash)
case 3:
ContentUnavailableView.init {
Label("Weather", systemImage: "cloud.rain")
}description: {
Text("No weather data recorded")
}actions: {
Button(action: {}, label: {
Label("Refresh",systemImage: "arrow.clockwise")
})
}
default:
Text("Nothing")
}
}
.padding()
}
}
#Preview {
ContentUnavailableView()
}