Last active
October 24, 2020 20:17
-
-
Save apatronl/6dcc3ff87bbfb076ae637c5b9af22c64 to your computer and use it in GitHub Desktop.
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 | |
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