ProductVM.swift 486 B

12345678910111213141516171819202122232425262728293031323334
  1. //
  2. // ProductVM.swift
  3. // SUIExamples
  4. //
  5. // Created by Pavel Yurchenko on 27.11.2024.
  6. //
  7. import SwiftUI
  8. @Observable
  9. final class ProductVM {
  10. struct Input {
  11. let id: Int
  12. }
  13. struct Output {
  14. var onProducts: Action?
  15. var onCart: Action?
  16. }
  17. let output: Output
  18. var productId: Int {
  19. input.id
  20. }
  21. private let input: Input
  22. init(input: Input, output: Output) {
  23. self.input = input
  24. self.output = output
  25. }
  26. }