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
ProductCell(product: product) |
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
ProductCell(product: .spaceShuttle) | |
.previewLayout(.sizeThatFits) |
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
extension ProductCell { | |
init(product: Product) { | |
self.init( | |
image: Image(product.imageName), | |
text: Text(product.name), | |
detailText: Text(product.description), | |
tertiaryText: Text(String(describing: product.price)) | |
) | |
} | |
} |
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
extension Product { | |
static let sydney: Self = .init( | |
id: 1, | |
name: "Sydney Opera House & Harbour Bridge", | |
description: "Capture the architectural essence and splendor of Sydney with this magnificent set that brings together the iconic Sydney Opera House™, Sydney Harbour Bridge, Sydney Tower and Deutsche Bank Place, in an inspirational skyline setting. Each individual LEGO® structure provides a unique and rewarding building experience with true-to-life color and relative scale depiction. Sydney's sparkling harbor is represented in the tiled baseplate, adding an extra dimension and feel of authenticity to this detailed recreation of one of the world's most glamorous cities.", | |
price: 98.0, | |
imageName: "sydney" | |
) | |
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
struct Product: Identifiable { | |
let id: Int | |
let name: String | |
let description: String | |
let price: Double | |
let imageName: String | |
} |
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
let image: Image | |
let text: Text | |
let detailText: Text | |
let tertiaryText: Text |
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
struct ProductCell: View { | |
var body: some View { | |
HStack { | |
Image(systemName: "photo") | |
.resizable(resizingMode: .stretch) | |
.aspectRatio(contentMode: .fit) | |
.frame(width: 60.0) | |
VStack(alignment: .leading) { | |
Text("Text") | |
.font(.title2) |
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
extension Article { | |
static let mocks: [Self] = [.blockChain, .airBlock] | |
} |
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
NewsCell(article: .airBlock) | |
.previewLayout(.sizeThatFits) |
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
extension NewsCell { | |
init(article: Article) { | |
self.init( | |
image: Image(article.smallImageName), | |
text: Text(article.title), | |
detailText: Text(article.detail), | |
tertiaryText: Text(String(describing: article.date)), | |
largeImage: Image(article.largeImageName) | |
) | |
} |
NewerOlder