If you want to install Xcode on Ubuntu, this is not possible, as Deepak has already pointed out: Xcode is not currently available on Linux, and I did not expect it to be in the foreseeable future.
However, if you want to install Swift on Ubuntu and play with it from the command line, this is pretty easy to do. Instructions are available at http://www.swift.org , but here’s a brief summary if you’re in your home directory:
1) Download the distribution:
user@ubuntu14 :~$ wget https://swift.org/builds/swift-2.2-release/ubuntu1404/swift-2.2-RELEASE/swift-2.2-RELEASE-ubuntu14.04.tar.gz
2) Unpack it:
user@ubuntu14 :~$ tar xf swift-2.2-RELEASE-ubuntu14.04.tar.gz
3) Prepare the location of the binaries for $PATH :
user@ubuntu14 :~$ export PATH=$HOME/swift-2.2-RELEASE-ubuntu14.04/usr/bin:$PATH
As for the installation. Now you can do a few things with it, these are just examples.
Run REPL:
user@ubuntu14 :~$ swift Welcome to Swift version 2.2 (swift-2.2-RELEASE). Type :help for assistance. 1> 1 + 3 $R0: Int = 4 2> :quit user@ubuntu14 :~$
Create the original Swift file, name it junk.swift with the following contents:
print("Hi from swift!")
Then run it through the Swift interpreter:
user@ubuntu14 :~$ swift junk.swift Hi from swift!
Now compile it using the Swift compiler:
user@ubuntu14 :~$ swiftc junk.swift
This will create an executable called junk in your current directory. Run it:
user@ubuntu14 :~$ ./junk Hi from swift!
You can do a lot more, see the documentation at https://swift.org/getting-started/#using-the-build-system
Please make sure your Ubuntu installation is 64-bit. If so, then the x86_64 line should be found somewhere in the output of the uname -a command. AFAIK, Apple currently only provides this software for 64-bit Ubuntu 14.04 or Ubuntu 15.10, make sure you download the correct version.
Another thing to note is that Swift on Linux is not as useful as on Mac OS X. Many libraries have not yet been ported. Again, see swift.org for more details.