My first program in SWIFT
There's a lot to be excited about this open source project. For the moment this may look like more imbecile version. With time this may be a big player to develop first-class applications for LINUX and Mac alike. Perhaps, APPLE's way of informing developer community that it wants a piece in server side market.
What you'll see in this version of SWIFT?
Glad you asked. This is a minimal version of SWIFT for the moment. Not much to speculate, except for enjoying the beauty of this language. It does not have support for UIKit, nor or there any mention about IDE's. For the moment treat it like building a command line C application. I am sure APPLE will bring in some version of XCode for LINUX or have partnership with leading IDE's like Webstorm/Sublime/Atom for application development. All of which depends on APPLE's direction and thought process.
For this post, I used sublime text (my choice of editor).
Head on to sublime text or any other editor of your choice. Put in the following code
print("Hello world!!!")
Save your file, name it helloworld.swift
Open terminal
browse to the location helloworld.swift
type in the following command
swift helloworld.swift
If you get any compilation errors, apart from code related issues, do the following
sudo apt-get install clang-3.6
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 100
Re-compile your code
swift helloworld.swift
You should not see any errors.
Do ls -l
You'll see 2 files
helloworld.swift
helloworld
One is the code you wrote and the other is compiled version of your code.
Execute helloworld
./helloworld
Output
Hello world!!!
There's a lot to be excited about this open source project. For the moment this may look like more imbecile version. With time this may be a big player to develop first-class applications for LINUX and Mac alike. Perhaps, APPLE's way of informing developer community that it wants a piece in server side market.
What you'll see in this version of SWIFT?
Glad you asked. This is a minimal version of SWIFT for the moment. Not much to speculate, except for enjoying the beauty of this language. It does not have support for UIKit, nor or there any mention about IDE's. For the moment treat it like building a command line C application. I am sure APPLE will bring in some version of XCode for LINUX or have partnership with leading IDE's like Webstorm/Sublime/Atom for application development. All of which depends on APPLE's direction and thought process.
For this post, I used sublime text (my choice of editor).
Head on to sublime text or any other editor of your choice. Put in the following code
print("Hello world!!!")
Save your file, name it helloworld.swift
Open terminal
browse to the location helloworld.swift
type in the following command
swift helloworld.swift
If you get any compilation errors, apart from code related issues, do the following
sudo apt-get install clang-3.6
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 100
Re-compile your code
swift helloworld.swift
You should not see any errors.
Do ls -l
You'll see 2 files
helloworld.swift
helloworld
One is the code you wrote and the other is compiled version of your code.
Execute helloworld
./helloworld
Output
Hello world!!!
No comments:
Post a Comment