Exploring Swift: What makes Swift great

02-14 03:30

Exploring Swift: What makes Swift great

The official Swift logo, named after Swift — the bird

StackOverflow 2017 survey placed Swift almost at the very top of the most loved language!

2017 StackOverflow survey

Actually — Swift almost took the number one spot in 2016 — Fair play Rust, fair play!

2016 StackOverflow survey

Rust and Swift are both amazing —although both serve a completely different purposes.

Rust is a systems programming language and Swift is a more general purpose language.

Why is Swift’s logo a bird?

After close observation — This fantastic Quora thread reveals the true nature (pun intended) of the intentions behind the Swift naming and logo.

Where Swift got it’s name from

“You want an animal, because, as O’Reilly have conclusively demonstrated, all programmers are closet shamans at heart.”

What makes Swift great?

Great question — Swift is great because it’s very fruitful, rewarding and versatile.

I’ll go into the why and how below.

Fruitful; Versatile

More common than you think; Oh look! I learned Swift and built a step tracker iOS app — two months later my iOS app hits the Apple Store and becomes a great success! Everyone loves it!

native iOS with Swift

You realize this could be something meaningful — time to build a Mac OS desktop dashboard application!

Oh jolly — I can use my past knowledge and use Swift again!

Fast forward 6 month; Wow! People love the desktop app as well!

I can make a side business of this.

Swift is a great way to develop native Mac OS desktop apps

In fact the iOS and desktop app combined became so successful — you no longer rely on any other financial sources other than the two apps you build.

The step tracker reached #1 on the Apple Store — I’m going to continue dominating my niche and adding support for different platforms.

What’s next? Oh, I know!

Swift supports watchOS

Yep, you guessed it, next up is Apple watch!

Apple watch is the absolute ideal candidate for a step tracker — and it uses the watchOSSwift is the language of choice for developing watchOS apps.

You could even develop games, tvOS , command line tools and cross platform apps with Swift!

Key points

  • Swift supports a wide array of platforms — including the web !
  • Swift allows you to bridge objective-C and C code.

Rewarding; Swift makes developers happy

The best way to hire the best engineers is simple — make the engineers happy and keep them happy. Give the engineers challenging, meaningful and exciting work.

Talk is cheap! Show us code!

Function which takes a name and prints it

Simple function which takes a name and prints it.

Line 5:The let keyword is a constant. 

Line 7:we have a traditional function called printName which takes 1 argument. Before the argument we have underscore _ — The underscore means we omit the argument label (you can name argument in Swift). The argument is called name and the type you must pass it is a String — after closing the parentheses, we have a -> Void — this lets Swift compiler know which type should the function return. If no type is returned we use the Void keyword. Void is a special type which explicitly tells the compiler return nothing.

Actually — in fact if we don’t specify a return type, Swift compiler assumes Void by default — so we can omit the function return type since we’re not returning anything.

Line 12:we call the function with our name;

Swift is a very flexible language which gives it a feel like writing Javascript while maintaining the compiled language performance.

I might get more technical in another chapter— Would you be interested in a mini-series about Swift? Please tweet (lasnindrek) or mention in the comments.

What about React Native, Swift’s biggest rival?

React Native is great, I’ve build couple mobile apps with RN .

Here’s the catch; when comparing RN to Swift – we tend to forget that Swift isn’t limited to mobile development like RN is.

React native

Both React Native and Swift are great. There is no ‘better’ – pick the right tool for the job.

As Abraham Maslow said in 1966

„I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail.“

Thanks for reading! If you found this useful — please give me some claps so more people can see this! ❤

Here are some of my past articles

标签: Swift
© 2014 TuiCode, Inc.