Created
June 18, 2020 21:29
-
-
Save wb-softwares/47d551b76a626e1b761c47781a1202f3 to your computer and use it in GitHub Desktop.
Recreating the Reminders app using SwiftUI and Swift Playgrounds on iPad
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
import SwiftUI | |
import PlaygroundSupport | |
struct Screen: View { | |
init() { | |
UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: UIColor.systemBlue] | |
UINavigationBar.appearance().titleTextAttributes = [.foregroundColor: UIColor.systemBlue] | |
} | |
@State var tasks = ["Meal Prep", "Call Family", "Do Laundry"] | |
var body: some View { | |
NavigationView { | |
VStack (alignment: .leading) { | |
List { | |
ForEach(self.tasks, id: \.self) { task in | |
HStack { | |
Image(systemName: "circle").resizable().frame(width: 20, height: 20) | |
Text(task) | |
} | |
}.onDelete { indexSet in | |
self.tasks.remove(atOffsets: indexSet) | |
} | |
} | |
Button(action:{}) { | |
HStack { | |
Image(systemName: "plus.circle.fill").resizable().frame(width: 20, height: 20) | |
Text("New Reminder").foregroundColor(.blue) | |
} | |
}.padding() | |
}.navigationBarTitle("Reminders").navigationBarItems(trailing: Button(action: {}) { | |
Image(systemName: "ellipsis.circle") | |
}) | |
} | |
} | |
} | |
PlaygroundPage.current.setLiveView(Screen()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment