Timer
Last updated
Was this helpful?
Last updated
Was this helpful?
⟩ ⟩
⭐️ 注意: 屬於 的類別
accepts a as its first parameter and a function to run as its second.
is called on the main thread. Avoid performing long-running tasks on the main thread. If you need to perform a long-running task in response to
value
changing, you should dispatch to a background queue.
Because conforms to the protocol, it won’t produce elements until you explicitly connect to it. Do this by either calling , or using an operator to connect automatically when a subscriber attaches.
👉 🍎 ⟩
⟩ ⟩ (class)
-> Timer.
Timer. (class)
-> .<Timer.TimerPublisher>
⟩ (protocol) ⟩
⭐️ - connects to the publisher, allowing it to produce elements, and returns an instance with which to cancel publishing.
⟩
⟩ (enum)
⟩ (struct) ⟩ . (instance property)
⟩ ⟩
- perform action when emitted data detected.
- perform action when specific value changes.
use @Environment .
use Timer. () Publisher.
問:「 What does do❓ .(timer) connects the timer to a view automatically❓」
答:「 automatically connects when the first subscriber subscribes, (timer) subscribes to the timer publisher. 」
問:「 What is a ❓ 」