Pramod Kumar
Pramod Kumar

Reputation: 2662

Facing some issues while working with SwiftUI (See Details)

I'm trying to create a screen in SwiftUI. In that I'm facing some issues, Like:

  1. NavigationButton is not working in the navigationBarItems.
  2. View are not starting from top of the screen always aligned at the centre of the screen.

Code:

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: "[email protected]") //View for creating row
        }
        .navigationBarItems(trailing:
            NavigationButton(destination: AddContactView()) {
                Text("Edit")
                    .font(AppFonts.Regular.withSize(17.0))
                    .foregroundColor(AppColors.themeGreen)
            }
    )
 }
}

If any one got some idea in that please help. Thank you in advance.

Upvotes: 0

Views: 227

Answers (1)

Curiosity
Curiosity

Reputation: 264

By using a ScrollView, it will start from the top of the screen.

Upvotes: 0

Related Questions