Skip to content

Sleep support for testing async delay #1106

Description

@momoohidayat

when i add try await Task.sleep() inside an async function, it will not return the console correctly

example code:

func fetchPosts() async throws -> String {
    try await Task.sleep(nanoseconds: 500_000_000) // simulate network delay
    return "Posts loaded"
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions