// --- PLEASE REPLACE YOUR OLD TimelineStep WITH THIS --- struct TimelineStep: View { let icon: String let title: String let description: String let isCompleted: Bool let isLast: Bool
var body: some View { HStack(alignment: .top, spacing: 20) { // --- FIX #1: ICON AND LINE CONNECTION --- // This VStack now has spacing set to 0 to remove the gap. VStack(alignment: .center, spacing: 0) { //Rectangle() // .fill(isCompleted ? Color.blue : Color(UIColor.systemGray5)) // .frame(width: 2) // .frame(maxHeight: .infinity)
if !isLast { Rectangle() .fill(isCompleted ? Color.blue : Color(UIColor.systemGray5)) .frame(width: 2) } } .frame(width: 40) // Give the icon column a fixed width .frame(maxHeight: .infinity) // 1. Expand the frame to fill the available height .background(.red)
Text(description) .font(.subheadline) .foregroundColor(.gray) .fixedSize(horizontal: false, vertical: true) // The .lineLimit modifier has been removed to allow wrapping. } .padding(.bottom, 32) .background(.green) // This is crucial for the text to wrap correctly by taking available space. .frame(maxWidth: .infinity, alignment: .leading) } .background(.yellow) .padding(.horizontal, 30) // Add padding to the whole row .padding(.bottom, isLast ? 0 : 0) // Control space between timeline steps } }
#Preview { ContentView() } [/code] Я получаю этот вывод.
my nfect wry wrice
< /ol> Почему это так? Я работал вместе с ИИ довольно долго. Мы оба все еще не можем понять, почему