Skip to content

Instantly share code, notes, and snippets.

@YutoMizutani
Last active June 29, 2018 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YutoMizutani/b78d222a1e7148720f9b0239e1de010f to your computer and use it in GitHub Desktop.
Save YutoMizutani/b78d222a1e7148720f9b0239e1de010f to your computer and use it in GitHub Desktop.
複数の.swiftファイルをSwift Package Managerを用いずにコンパイルする ref: https://qiita.com/YutoMizutani/items/ba8f993ef2ef8b04fb18
$ swiftc main.swift hello.swift
$ ./main
cat << 'EOT' > main.swift
import Foundation
let hello = Hello()
hello.say()
EOT
cat << 'EOT' > hello.swift
import Foundation
struct Hello {
func say() {
print("Hello, world!!")
}
}
EOT
swiftc -o main main.swift hello.swift
./main
rm main.swift hello.swift main # 後片付け
import Foundation
struct Hello {
func say() {
print("Hello, world!!")
}
}
import Foundation
let hello = Hello()
hello.say()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment