Last active
July 12, 2020 15:08
-
-
Save apatronl/7a2f06ac7fda6d208cae5c4086b581fd to your computer and use it in GitHub Desktop.
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
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