Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

试写一个demo 设定固定时间之后 并没用打印 #71

Open
zhaoquntao opened this issue Aug 9, 2022 · 2 comments
Open

试写一个demo 设定固定时间之后 并没用打印 #71

zhaoquntao opened this issue Aug 9, 2022 · 2 comments

Comments

@zhaoquntao
Copy link

let t1 = Plan.after(1.second).do { print("1 second passed") }

设定固定时间之后 并没用打印 还需要配置什么?

@kkkkkkkkNight
Copy link

同问

@94794
Copy link

94794 commented Jan 26, 2024

如果您未指定队列或应用程序中没有可用的 RunLoop,则不会打印它。 (参见此处

为了让它工作,你需要指定队列:

let t1 = Plan.after(1.second).do(queue: .global()) { print("1 second passed") }

或者有一个可用的 RunLoop,如下所示:

let t1 = Plan.after(1.second).do { print("1 second passed") }
CFRunLoopRun()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants