As I noted above, this looks like the current limitation using the Swift package manager . It currently does not support the addition of appropriate compile-time parameters, such as those needed to support blocks as input to GCD functions ( -Xcc -fblocks ).
In the meantime, you can avoid the Swift Package Manager and compile your files directly using swiftc with the appropriate options. An example is provided by a sheffler in a test repository :
swiftc -v -o gcd4 Sources/main.swift -I .build/debug -j8 -Onone -g -Xcc -fblocks -Xcc -F-module-map=Packages/CDispatch-1.0.0/module.modulemap -I Packages/CDispatch-1.0.0 -I /usr/local/include
The -I options will pull your module maps for libdispatch, so configure them to match where you actually placed these system module directories.
source share