SwiftUI cuts off Text

Viewed 45

I am rewriting the existing UIKit cell using SwiftUI. The problem is Spacer() cuts Text() and shows less text than the UIKit version (Ethereum C... vs Ethere...). The goal is to have the graph always in the same position in all cells and show more symbols in Text().

var body: some View {
    VStack(alignment: .center) {
        ZStack {
            HStack(spacing: .designSystem(.small)) {
                KFImage(viewModel.tradable.logoURL)
                    .serialize(by: SVGCacheSerializer())
                    .setProcessor(SVGProcessor())
                    .scaleFactor(Layout.scaleFactor)
                    .resizable()
                    .placeholder {
                        Circle()
                            .fill(Color(viewModel.tradable.placeholderColor == nil ? .gray : UIColor(hex: viewModel.tradable.placeholderColor!)))

                    }
                    .frame(width: Layout.imageWidth, height: Layout.imageHeight)
                    .clipShape(RoundedRectangle(cornerRadius: Layout.imageWidth / 2))
                    .overlay(RoundedRectangle(cornerRadius: Layout.imageWidth / 2).stroke(.white, lineWidth: 2 / UIScreen.main.scale))

                VStack(alignment: .leading, spacing: .designSystem(.extraSmall3)) {
                    Text(viewModel.name).font(.subheadline).fontWeight(.semibold).lineLimit(1)
                    Text(viewModel.symbol).font(.caption2).foregroundColor(Color(ThemeManager.current.neutral50))
                }

                Spacer()

                AssetLineChartViewRepresentable(viewModel: chartViewModel).frame(width: 65, height: 20)

                Spacer()

                VStack(alignment: .trailing, spacing: .designSystem(.extraSmall3)) {
                    percentChangeView(assetPercentChangeType: viewModel.assetPercentChangeType)
                    Text(viewModel.priceString).font(.caption2).foregroundColor(Color(ThemeManager.current.neutral50))

                }
            }
            .padding([.leading, .trailing])

            if !viewModel.shouldHideSeparator {
                VStack {
                    Spacer()
                    Divider().padding(.leading)
                }
            }
        }
    }
    .frame(height: Layout.frameHeight)
    .background(
        backgroundView(assetPositionType: viewModel.corners)
    )
}

image

Removing Spacer()

enter image description here

0 Answers
Related