I have always found app development to be very interesting, so I started learning more about Swift in Xcode. Currently, I am working on creating an overview page for cars that are on sale, but I have run into an issue with the content going outside the frame. I attempted to fix the problem by adding a ScrollView on my VStack, but this did not solve the issue.
import SwiftUI
struct ContentView: View {
var body: some View {
ZStack{
Color(.white)
.ignoresSafeArea()
ScrollView{
VStack(alignment: .leading, spacing: 20.0)
{
Text("Aanbevolen")
.font(.system(size: 36))
.fontWeight(.semibold)
ForEach(0..<4) { index in
Image("car")
.resizable()
.aspectRatio(contentMode: .fit)
.cornerRadius(5)
HStack{
Text("145347km")
.font(.caption)
.padding(.vertical, 5.0)
.padding(.horizontal, 10.0)
.background(.gray)
.cornerRadius(10)
Text("03/2018")
.font(.caption)
.padding(.vertical, 5.0)
.padding(.horizontal, 10.0)
.background(.gray)
.cornerRadius(10)
Text("235kW(320PK)")
.font(.caption)
.padding(5.0)
.padding(.horizontal, 7.0)
.background(.gray)
.cornerRadius(10)
}
Text("TeslaModel S85 Performance 2015 | MARGE | Free Supercharge")
.font(.title2)
.fontWeight(.semibold)
Text("€ 24.800,-")
.font(.title)
.fontWeight(.heavy)
}
Text("Recent toegevoegd")
.font(.system(size: 36))
.fontWeight(.semibold)
}
.padding()
}
}
}
}