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 | |
struct ContentView: View { | |
var body: some View { | |
NavigationView { | |
List { | |
ForEach(0..<25, id: \.self, content: { i in | |
NavigationLink("(\(i)) Hello, world!", destination: EmptyView()) | |
}) | |
} |
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
var body: some View { | |
NavigationView { | |
List { | |
ForEach(0..<10, content: { i in | |
Text("\(i): 🥳") | |
.font(.largeTitle) | |
.padding([.top, .bottom]) | |
}) | |
} | |
.foregroundColor(.black) |
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 Foundation | |
public struct EmojiDetails { | |
public let emoji: String | |
public let name: String | |
public let description: String | |
} | |
// MARK: - Identifiable |
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 Foundation | |
public struct EmojiProvider { | |
/// Creates a list of emoji details that includes an emoji along with its name and description. | |
/// - Returns: The list of `EmojiDetail`s | |
/// - Note: Emoji descriptions obtained from [Empojipedia](https://emojipedia.org/). | |
static func all() -> [EmojiDetails] { | |
return [ | |
EmojiDetails( |
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 { | |
// ... | |
} | |
struct EmojiItemView: View { | |
let emoji: String | |
let emojiName: String | |
var body: some View { | |
Text("\(emoji) \(emojiName)") |
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() | |
var body: some View { | |
NavigationView { | |
List { | |
ForEach(emojiData, content: { emojiDetails in | |
EmojiItemView(emoji: emojiDetails.emoji, emojiName: emojiDetails.name) | |
}) |
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 { | |
// ... | |
} | |
struct EmojiItemView: View { | |
// ... | |
} | |
struct EmojiDetailsView: View { | |
var emojiDetails: EmojiDetails |
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: { |
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 | |
struct EmojiWidgetView: View { | |
let emojiDetails: EmojiDetails | |
var body: some View { | |
ZStack { | |
Color(UIColor.systemIndigo) | |
VStack { |