ProductView.swift 617 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // ProductView.swift
  3. // SUIExamples
  4. //
  5. // Created by Pavel Yurchenko on 17.08.2024.
  6. //
  7. import SwiftUI
  8. struct ProductView: View {
  9. @Environment(ProductVM.self) private var vm
  10. var body: some View {
  11. VStack {
  12. Text("Product")
  13. Spacer()
  14. Text("#\(vm.objectId)")
  15. Spacer()
  16. Button("Products") {
  17. vm.output.onProducts?()
  18. }
  19. Button("Cart") {
  20. vm.output.onCart?()
  21. }
  22. }
  23. .padding()
  24. }
  25. }
  26. #Preview {
  27. ProductBuilder().build(with: .init(id: 25), output: .init())
  28. }