ViewModel.swift 779 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // ViewModel.swift
  3. // naiyoup
  4. //
  5. // Created by C Auto on 2021/7/30.
  6. //
  7. //
  8. // File.swift
  9. // SwiftUIWebView
  10. //
  11. // Created by Md. Yamin on 4/25/20.
  12. // Copyright © 2020 Md. Yamin. All rights reserved.
  13. //
  14. import Foundation
  15. import Combine
  16. class ViewModel: ObservableObject {
  17. var webViewNavigationPublisher = PassthroughSubject<WebViewNavigation, Never>()
  18. var showWebTitle = PassthroughSubject<String, Never>()
  19. var showLoader = PassthroughSubject<Bool, Never>()
  20. var valuePublisher = PassthroughSubject<String, Never>()
  21. }
  22. // For identifiying WebView's forward and backward navigation
  23. enum WebViewNavigation {
  24. case backward, forward, reload
  25. }
  26. // For identifying what type of url should load into WebView
  27. enum WebUrlType {
  28. case localUrl, publicUrl
  29. }