mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-04-11 03:27:12 +02:00
Add Async image loading
This commit is contained in:
43
Examples/Time Travel/SwiftUITimeTravel/TodoList/TodoListView.swift
Executable file
43
Examples/Time Travel/SwiftUITimeTravel/TodoList/TodoListView.swift
Executable file
@@ -0,0 +1,43 @@
|
||||
import SwiftUI
|
||||
|
||||
struct TodoListView : View {
|
||||
|
||||
@EnvironmentObject var store: Store<TodoState>
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
NavigationView {
|
||||
List(store.state.todoItems) { item in TodoListItemView(item: item) }
|
||||
.navigationBarTitle(Text("Todo List"))
|
||||
.navigationBarItems(trailing: Button(action: {
|
||||
withAnimation {
|
||||
self.store.dispatch(event: .startCreatingItem)
|
||||
}
|
||||
}, label: { Image(systemName: "plus.circle") })) }
|
||||
|
||||
if store.state.isCreatingItem {
|
||||
|
||||
ModalDimmingView()
|
||||
|
||||
VStack {
|
||||
Spacer()
|
||||
AddItemView()
|
||||
.relativeWidth(1.0)
|
||||
.background(Color.white)
|
||||
.cornerRadius(12.0)
|
||||
.shadow(radius: 16.0)
|
||||
.padding()
|
||||
Spacer()
|
||||
}
|
||||
.transition(.move(edge: .bottom))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if DEBUG
|
||||
struct TodoListView_Previews : PreviewProvider {
|
||||
static var previews: some View {
|
||||
TodoListView()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user