-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
SwiftUI-Apprentic/SwiftUI-Apprentic/Views/Demos/Todo/AddTodoItemView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// AddTodoItem.swift | ||
// SwiftUI-Apprentic | ||
// | ||
// Created by zzz on 2022/1/6. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct AddTodoItemView: View { | ||
@State var content = "" | ||
|
||
var body: some View { | ||
VStack(alignment: .leading) { | ||
TextField("Enter your todo item", text: $content) | ||
.padding() | ||
Button { | ||
// save todo item | ||
} label: { | ||
Image(systemName: "plus") | ||
.padding() | ||
.foregroundColor(.white) | ||
.background(Color.red) | ||
.cornerRadius(10) | ||
} | ||
Spacer() | ||
} | ||
.padding() | ||
.background(Color.green) | ||
} | ||
} | ||
|
||
struct AddTodoItem_Previews: PreviewProvider { | ||
static var previews: some View { | ||
AddTodoItemView() | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
SwiftUI-Apprentic/SwiftUI-Apprentic/Views/Demos/Todo/TodoDetailView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// TodoDetailView.swift | ||
// SwiftUI-Apprentic | ||
// | ||
// Created by zzz on 2022/1/6. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct TodoDetailView: View { | ||
var content: String | ||
|
||
var body: some View { | ||
Text(content) | ||
} | ||
} | ||
|
||
struct TodoDetailView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
TodoDetailView(content: "") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters