Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import SwiftUI
struct EmojibookListView: View {
let emojiData = EmojiProvider.all()
var body: some View {
NavigationView {
List(emojiData) { emojiDetails in
NavigationLink(destination: EmojiDetailsView(emojiDetails: emojiDetails)) {
EmojiItemView(emoji: emojiDetails.emoji, emojiName: emojiDetails.name)
}
}
.foregroundColor(.black)
.listStyle(InsetGroupedListStyle())
.navigationBarTitle("Emojibook")
}
}
}
struct EmojiItemView: View {
let emoji: String
let emojiName: String
var body: some View {
Text("\(emoji) \(emojiName)")
.font(.largeTitle)
.padding([.top, .bottom])
}
}
struct EmojiDetailsView: View {
var emojiDetails: EmojiDetails
var body: some View {
VStack(alignment: .leading) {
Text(emojiDetails.description)
.font(.title)
Spacer()
}
.padding([.leading, .trailing])
.navigationBarTitle("\(emojiDetails.emoji) \(emojiDetails.name)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment