Skip to content

Instantly share code, notes, and snippets.

@apatronl
Last active July 12, 2020 15:08
Show Gist options
  • Save apatronl/7a2f06ac7fda6d208cae5c4086b581fd to your computer and use it in GitHub Desktop.
Save apatronl/7a2f06ac7fda6d208cae5c4086b581fd to your computer and use it in GitHub Desktop.
struct EmojibookListView: View {
let emojiData: [EmojiDetails] = EmojiProvider.all()
@State private var showingDetail: Bool = false
var body: some View {
NavigationView {
List {
ForEach(emojiData, content: { emojiDetails in
Button(action: {
showingDetail.toggle()
}, label: {
EmojiItemView(emoji: emojiDetails.emoji, emojiName: emojiDetails.name)
})
.sheet(isPresented: $showingDetail) {
EmojiDetailsView(emojiDetails: emojiDetails)
}
})
}
.foregroundColor(.black)
.listStyle(InsetGroupedListStyle())
.navigationBarTitle("Emojibook")
}
}
}
struct EmojiItemView: View {
// ...
}
struct EmojiDetailsView: View {
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment