Advertisement
Xaniasty

Untitled

May 24th, 2024
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. import SwiftUI
  2.  
  3. struct RecipeDetailView: View {
  4. var recipe: Recipe
  5.  
  6. var body: some View {
  7. VStack {
  8. Image(recipe.filename)
  9. .resizable()
  10. .aspectRatio(contentMode: .fit)
  11. .frame(height: 200)
  12.  
  13. Text(recipe.name)
  14. .font(.title)
  15. .padding()
  16.  
  17. Text(recipe.description)
  18. .font(.body)
  19. .padding()
  20. }
  21. .navigationTitle(recipe.name)
  22. .navigationBarBackButtonHidden(true) // Ukryj wbudowany przycisk "Back"
  23. .navigationBarItems(leading: backButton) // Dodaj niestandardowy przycisk powrotu
  24. }
  25.  
  26. var backButton: some View {
  27. Button(action: {
  28. // Powrót do widoku RecipeGridView
  29. // Możesz użyć pop() lub dismiss() w zależności od kontekstu nawigacji
  30. // Na przykład:
  31. // navigationViewBinding?.wrappedValue.dismiss()
  32. // lub:
  33. // navigationController?.popViewController(animated: true)
  34. }) {
  35. HStack {
  36. Image(systemName: "chevron.left")
  37. Text("Powrót")
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement