Git Product home page Git Product logo

Comments (11)

thierrybucco avatar thierrybucco commented on August 25, 2024 4

+1

from async.

dearbar avatar dearbar commented on August 25, 2024 2

From migration-guide-swift4
reference.value = block() change to reference.value = block(())
Maybe right!

from async.

imxieyi avatar imxieyi commented on August 25, 2024

This works for me:

    private static func async<O>(after seconds: Double? = nil, block: @escaping () -> O, queue: GCD) -> AsyncBlock<Void, O> {
        let reference = Reference<O>()
        let block = DispatchWorkItem(block: {
            reference.value = block()
        })

        if let seconds = seconds {
            let time = DispatchTime.now() + seconds
            queue.queue.asyncAfter(deadline: time, execute: block)
        } else {
            queue.queue.async(execute: block)
        }

        // Wrap block in a struct since @convention(block) () -> Swift.Void can't be extended
        return AsyncBlock<Void, O>(block, output: reference)
    }

from async.

SF-Simon avatar SF-Simon commented on August 25, 2024

I also need swift4, hoping to use it as soon as possible

from async.

hy9be avatar hy9be commented on August 25, 2024

Same issue.

from async.

edenman avatar edenman commented on August 25, 2024

#122 looks like it would fix this, fwiw

from async.

mario-huang avatar mario-huang commented on August 25, 2024

+1

from async.

sushiwu avatar sushiwu commented on August 25, 2024

+1

from async.

dearbar avatar dearbar commented on August 25, 2024

from async.

rlam3 avatar rlam3 commented on August 25, 2024

@duemunk Any updates on this? Thanks!

from async.

duemunk avatar duemunk commented on August 25, 2024

Fixed by #122

from async.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.