Skip to content
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

[ProductInfo] 테스트 네트워킹 작업 #46

Merged
merged 12 commits into from
Feb 19, 2024
Prev Previous commit
🔥 요청 사항 수정
eung7 committed Feb 19, 2024
commit cfd0b00ae8b7f00c4815ea056e77d134a7fe600a
9 changes: 0 additions & 9 deletions Entity/Sources/Entity/ProductDetail.swift
Original file line number Diff line number Diff line change
@@ -44,13 +44,4 @@ public struct ProductDetail: Identifiable {
self.promotion = promotion
self.convenienceStore = convenienceStore
}

public init() {
id = -1
imageURL = nil
price = 0
name = ""
promotion = .allItems
convenienceStore = ._7Eleven
}
}
Original file line number Diff line number Diff line change
@@ -20,10 +20,19 @@ enum ProductInfoAction {
// MARK: - ProductInfoState

struct ProductInfoState {
var product: ProductDetail = .init()
var product: ProductDetail = mockProduct
var previousProducts: [ProductDetail] = []
}

private let mockProduct = ProductDetail(
id: 0,
imageURL: nil,
price: 0,
name: "",
promotion: .allItems,
convenienceStore: ._7Eleven
)

// MARK: - ProductInfoViewModelRepresentable

@MainActor
@@ -39,7 +48,7 @@ final class ProductInfoViewModel: ProductInfoViewModelRepresentable {
private let service: ProductInfoServiceRepresentable
private var subscriptions: Set<AnyCancellable> = .init()

@Published var state: ProductInfoState = .init()
@Published private(set) var state: ProductInfoState = .init()

init(service: ProductInfoServiceRepresentable) {
self.service = service