Asynchronous I/O in Swift
Swift Objective-C
Latest commit bdb9a46 Nov 3, 2016 @elliottminns committed on GitHub Update README.md
Permalink
Failed to load latest commit information.
Sources
Tests/Echo
Xcode/Echo
.gitignore
.travis.yml
Package.swift
README.md

README.md

This project is being developed as Fire

Echo

Echo is a simple way to create an event loop and use GCD in Swift for Linux and OSX

Travis-Badge

How to use?

Using Echo is simple, to start the main run loop, just call:

Echo.beginEventLoop()

or

Echo.begin()

When you want to exit the loop, just call exit

Echo.exit()

How to use GCD?

Using GCD is the same as with Mac OS X (With limited current features)

main.swift
import Echo

dispatch_async(dispatch_get_global_queue(0, 0)) {
    for i in 0 ..< 1000 {
        dispatch_async(dispatch_get_main_queue()) {
            print(i)
        }
    }

    dispatch_async(dispatch_get_main_queue()) {
        Echo.exit()
    }
}

Echo.begin()

The above code snippet will print all the numbers on the main loop whilst looping in the global queue.

What is it used for?

Is that it?

Yep, it's that simple.

Please feel free to fork and extend to the rest of GCD's functions for Linux