Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SwiftUI
- struct RecipeDetailView: View {
- var recipe: Recipe
- var body: some View {
- VStack {
- Image(recipe.filename)
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(height: 200)
- Text(recipe.name)
- .font(.title)
- .padding()
- Text(recipe.description)
- .font(.body)
- .padding()
- }
- .navigationTitle(recipe.name)
- .navigationBarBackButtonHidden(true) // Ukryj wbudowany przycisk "Back"
- .navigationBarItems(leading: backButton) // Dodaj niestandardowy przycisk powrotu
- }
- var backButton: some View {
- Button(action: {
- // Powrót do widoku RecipeGridView
- // Możesz użyć pop() lub dismiss() w zależności od kontekstu nawigacji
- // Na przykład:
- // navigationViewBinding?.wrappedValue.dismiss()
- // lub:
- // navigationController?.popViewController(animated: true)
- }) {
- HStack {
- Image(systemName: "chevron.left")
- Text("Powrót")
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement