-
Notifications
You must be signed in to change notification settings - Fork 0
Bridge #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| protocol RenderableProductView { | ||
| func render() -> [ComponentView] | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code included a number of properties in this protocol that leaked implementation details. Removed them and updated render to return the array of [ComponentView] as it's cleaner.
| struct AppleWatchSummaryView: RenderableProductView { | ||
| private let product: Product | ||
| private let componentRenderer: ProductComponentRenderer | ||
|
|
||
| func render() -> [ComponentView] { | ||
| [ | ||
| componentRenderer.renderTitleView(for: product), | ||
| componentRenderer.renderPriceView(for: product), | ||
| componentRenderer.renderCarouselView(for: product) | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| class CreditCardPaymentProvider: PaymentProvider { | ||
| func processPayment(amount: Double) async -> Result<String, Error> { | ||
| return .success("Visa payment succeeded.") | ||
| struct AppleWatchTechSpecsView: RenderableProductView { | ||
| private let product: Product | ||
| private let componentRenderer: ProductComponentRenderer | ||
|
|
||
| func render() -> [ComponentView] { | ||
| [ | ||
| componentRenderer.renderTitleView(for: product), | ||
| componentRenderer.renderPriceView(for: product), | ||
| componentRenderer.renderTechSpecsView(for: product) | ||
| ] | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed these concretions to structs, removed redundant private(set), and redundant inits.
No description provided.