Created
May 18, 2020 16:58
-
-
Save navsing/c7b14c934dbce15197ec155ad5adce3f to your computer and use it in GitHub Desktop.
Let’s recreate the Reminder app in less than 5 minutes using SwiftUI and Swift Playgrounds on iPad
This file contains hidden or 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