ViewModel.swift 649 B

12345678910111213141516171819202122232425
  1. //
  2. // ViewModel.swift
  3. // fiveConstant
  4. //
  5. // Created by 李建 on 2023/1/14.
  6. //
  7. import Foundation
  8. import Combine
  9. class ViewModel: ObservableObject {
  10. var webViewNavigationPublisher = PassthroughSubject<WebViewNavigation, Never>()
  11. var showWebTitle = PassthroughSubject<String, Never>()
  12. var showLoader = PassthroughSubject<Bool, Never>()
  13. var valuePublisher = PassthroughSubject<String, Never>()
  14. }
  15. // For identifiying WebView's forward and backward navigation
  16. enum WebViewNavigation {
  17. case backward, forward, reload
  18. }
  19. // For identifying what type of url should load into WebView
  20. enum WebUrlType {
  21. case localUrl, publicUrl
  22. }