KMEmbeddedPaymentPopWC.swift 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // KMEmbeddedPaymentPopWC.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by wanjun on 2024/9/4.
  6. //
  7. import Cocoa
  8. import WebKit
  9. class KMEmbeddedPaymentPopWC: NSWindowController {
  10. @IBOutlet weak var webView: WKWebView!
  11. var urlPath: String?
  12. static var currentWindowController: KMEmbeddedPaymentPopWC!
  13. @objc static func currentFirstTrialWC(_ urlPath: String) -> KMEmbeddedPaymentPopWC {
  14. if currentWindowController != nil {
  15. currentWindowController.urlPath = urlPath
  16. return currentWindowController
  17. } else {
  18. let configWC: KMEmbeddedPaymentPopWC = KMEmbeddedPaymentPopWC.init(windowNibName: "KMEmbeddedPaymentPopWC")
  19. currentWindowController = configWC;
  20. currentWindowController.urlPath = urlPath
  21. return currentWindowController
  22. }
  23. }
  24. override func windowDidLoad() {
  25. super.windowDidLoad()
  26. // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
  27. if urlPath != nil {
  28. if let url = URL(string: urlPath!) {
  29. let request = URLRequest(url: url)
  30. webView.load(request)
  31. }
  32. }
  33. }
  34. }