SwiftUI how to adjust different screen sizes
You are putting static spacing so that issue is occurring. you can fix it using Spacer()
Modifier and give some Frame()
.
var body: some View {
NavigationView {
List {
ForEach(peoples, id: \.self) {person in
PersonView(person: person)
}
}.navigationBarItems(leading:
VStack(spacing: 5) { // Change Spacing as you want
HStack {
Text("Find People").font(.system(size: 30)).bold()
Spacer()
Text("Follow All").foregroundColor(Color(ColorUtils.hexStringToUIColor(hex: Constants.THEME.THEME_COLOR)))
}
HStack() {
Text("Import from:")
Spacer()
ForEach(socialIcons, id: \.self) {icon in
Image(icon).resizable().frame(width: 25, height: 25)
.padding(.horizontal)
}
}
}.frame(width: UIScreen.main.bounds.width-20, alignment: .center)
)
}
}