Last active
June 6, 2018 13:10
-
-
Save kaleocheng/f0bbd7cc256d74dcef59783c790bff5b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/swift | |
# How to run: | |
# swiftc dict.swift | |
# ./dict hello | |
import Foundation | |
if (CommandLine.argc < 2) { | |
print("Usage: dictionary word") | |
}else{ | |
let argument = CommandLine.arguments[1] | |
let result = DCSCopyTextDefinition(nil, argument as CFString, CFRangeMake(0, argument.count))?.takeRetainedValue() as String? | |
print(result ?? "") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment