โฐTimer
โญ๏ธ ๆณจๆ๏ผTimer ๅฑฌๆผ Foundation ็้กๅฅ
.onReceive()
accepts a publisher as its first parameter and a function to run as its second.
.onChange()
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 Timer.TimerPublisher
conforms to the ConnectablePublisher
protocol, it wonโt produce elements until you explicitly connect to it. Do this by either calling connect()
, or using an autoconnect()
operator to connect automatically when a subscriber attaches.
๐ ๐ โฉ Replacing Foundation Timers with Timer Publishers
Last updated
Was this helpful?