Я пытаюсь создать экран в SwiftUI.В этом я сталкиваюсь с некоторыми проблемами, например:
NavigationButton
не работает в navigationBarItems
. - Вид не начинается с верхней части экрана и всегда выравнивается поцентр экрана.
Код:
struct ContactDetailView : View {
var body: some View {
VStack {
ContactDetailHeaderView()
.edgesIgnoringSafeArea(.top)
.frame(height: UIDevice.screenWidth*0.8)
.listRowInsets(EdgeInsets())
.background(LinearGradient(gradient: Gradient(colors: [AppColors.white, AppColors.themeGreen.opacity(0.6)]), startPoint: .top, endPoint: .bottom), cornerRadius: 0)
ContactDetailRow(title: "Mobile", description: "+91 1248932410") //View for creating row
ContactDetailRow(title: "Email", description: "pramod@yopmail.com") //View for creating row
}
.navigationBarItems(trailing:
NavigationButton(destination: AddContactView()) {
Text("Edit")
.font(AppFonts.Regular.withSize(17.0))
.foregroundColor(AppColors.themeGreen)
}
)
}
}
Если у кого-то есть идеи, пожалуйста, помогите.Заранее спасибо.