The Execute a Swift Script action executes a specified Swift script, either from a file or text.
The results of the script can be:
Swift scripts can get (but not set) Keyboard Maestro Variables by using environment variables, for example:
Swift 2 (Xcode 7 and 8)
import Foundation print(NSProcessInfo.processInfo().environment["KMVAR_Variable_Name"]!)
Swift 3 (currently beta, Xcode 8)
import Foundation print(ProcessInfo.processInfo.environment["KMVAR_Variable_Name"]!)