Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Swift code to native executable for Linux

Tags:

linux

swift

I've installed Swift lang for Linux (Ubuntu) and it works fine. For example:

print("Hello World")

To run it:

./swift hi.swift

My question is, is it possible to generate a native executable code for it? How?

like image 391
masoud Avatar asked Sep 02 '26 12:09

masoud


1 Answers

Listing the executable files in the Swift directory, it has swiftc. It generates a native executable binary by command:

swiftc hi.swift -o hi
./hi
like image 96
masoud Avatar answered Sep 05 '26 01:09

masoud



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!