Showing
2 changed files
with
7 additions
and
7 deletions
No preview for this file type
... | @@ -10,7 +10,7 @@ import UIKit | ... | @@ -10,7 +10,7 @@ import UIKit |
10 | import WebKit | 10 | import WebKit |
11 | import SwiftEventBus | 11 | import SwiftEventBus |
12 | 12 | ||
13 | -var timer: DispatchSourceTimer? | 13 | +var timer2: DispatchSourceTimer? |
14 | 14 | ||
15 | @objc public class CampaignViewController: UIViewController, WKNavigationDelegate, WKScriptMessageHandler { | 15 | @objc public class CampaignViewController: UIViewController, WKNavigationDelegate, WKScriptMessageHandler { |
16 | @IBOutlet weak var webview: WKWebView! | 16 | @IBOutlet weak var webview: WKWebView! |
... | @@ -63,9 +63,9 @@ var timer: DispatchSourceTimer? | ... | @@ -63,9 +63,9 @@ var timer: DispatchSourceTimer? |
63 | print("========= Webview Timer Started! =========") | 63 | print("========= Webview Timer Started! =========") |
64 | 64 | ||
65 | let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".webview.timer") | 65 | let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".webview.timer") |
66 | - timer = DispatchSource.makeTimerSource(queue: queue) | 66 | + timer2 = DispatchSource.makeTimerSource(queue: queue) |
67 | - timer!.schedule(deadline: .now(), repeating: .seconds(1)) | 67 | + timer2!.schedule(deadline: .now(), repeating: .seconds(1)) |
68 | - timer!.setEventHandler { [weak self] in | 68 | + timer2!.setEventHandler { [weak self] in |
69 | // do whatever stuff you want on the background queue here here | 69 | // do whatever stuff you want on the background queue here here |
70 | print("========= Webview interval! =========") | 70 | print("========= Webview interval! =========") |
71 | 71 | ||
... | @@ -82,13 +82,13 @@ var timer: DispatchSourceTimer? | ... | @@ -82,13 +82,13 @@ var timer: DispatchSourceTimer? |
82 | }) | 82 | }) |
83 | } | 83 | } |
84 | } | 84 | } |
85 | - timer!.resume() | 85 | + timer2!.resume() |
86 | } | 86 | } |
87 | 87 | ||
88 | func stopTimer() { | 88 | func stopTimer() { |
89 | print("========= Webview Timer Stopped! =========") | 89 | print("========= Webview Timer Stopped! =========") |
90 | - timer?.cancel() | 90 | + timer2?.cancel() |
91 | - timer = nil | 91 | + timer2 = nil |
92 | } | 92 | } |
93 | 93 | ||
94 | // MARK: - API Calls | 94 | // MARK: - API Calls | ... | ... |
-
Please register or login to post a comment