Use UIViewPreview which implements UIViewRepresentable ⬇️
https://gist.github.com/mattt/ff6b58af8576c798485b449269d43607#file-uiviewpreview-swift
final class ProfitStatusStockCell: UICollectionViewCell {
}
#if DEBUG
import SwiftUI
struct ProfitStatusStockCell_Preview: PreviewProvider {
static var previews: some View {
UIViewPreview {
let view = ProfitStatusStockCell()
let viewModel = ProfitStatusStockModel(image: RoundLogo.Image(nil, placeholder: .stock), title: "카카오", value: "-28,765원", percent: "(-0.43%)", trend: .down)
view.viewModel = viewModel
return view.withContentSize(.init(width: 303, height: ProfitStatusStockCell.height))
}
.previewLayout(.sizeThatFits)
UIViewPreview {
let view = ProfitStatusStockCell()
let viewModel = ProfitStatusStockModel(image: RoundLogo.Image(nil, placeholder: .stock), badgeImage: .image(Asset.Icons.icExchangeUpbit12.image.withRenderingOriginal), title: "카카오", value: "-28,765원", percent: "(-0.43%)", trend: .down)
view.viewModel = viewModel
return view.withContentSize(.init(width: 303, height: ProfitStatusStockCell.height))
}
.previewLayout(.sizeThatFits)
}
}
#endif