11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SwiftのコードをXcode使わずにコンパイルする

Posted at

おそらく使うことはないだろうけど、必要にかられて調べたのでメモ。

hoge.swift
for (var i = 1; i < 10; i++) {
	println(i)
}

普通に、Swiftでコードを書く。そして、swiftcコマンドでコンパイルする。これだけ。

$ swiftc -o hoge hoge.swift
$ ./hoge

SDKなどを使いたくなったらオプションで指定する。

hoge.swift
import Foundation

# snip
$ swiftc -sdk $(xcrun --show-sdk-path --sdk macosx) -o hoge hoge.swift
11
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?