Remix.run Logo
deze333 7 hours ago

What is Swift? Why Swift? A lot of discussion here touched this topic. My experience here after 10 years with Swift, starting from version 1. This is how I understood the language through the process of creating several apps (and web services) of non-trivial complexity.

  Swift helps those who want to build end-user products.
Swift is the language for those who need to deliver end-user products, deliver fast and iterate often with minimal friction. You got to be a practical creator who needs to create and deploy to market fast. It's all about achievability of end result within modern world's time constraints. This is where it shines.

  Swift may not fit more pure paradigms.
If you're after the pure art of programming then other languages may speak to you better.

In other words, Swift is extremely PRACTICAL – meaning create, deploy and earn living – and is squarely focused on people who need that. Naturally, not everybody will resonate with its core mission statement.

wslh 7 hours ago | parent [-]

As a casual Swift desktop developer, I also wonder about how practical and fast Swift is, especially when compared to scripting languages like Python.

For instance, last week, I was working on bit manipulation and realized that Swift has methods to count 1 and 0 bits:

let value: UInt8 = 0b11010101

let count = value.nonzeroBitCount

deze333 6 hours ago | parent | next [-]

It's fast enough to make running an app feel like running a native app – faster start time, less memory used, less power hungry, more responsive UI – compared to browser based cross-platform apps.

One can say it achieves maximum user interaction speed.

For most critical calculations, one can easily integrate C++/C libraries – at the source code level – which Swift can compile, link and call directly.

Or drop down to unsafe features of Swift and achieve speeds comparable to C++. But that's not really needed in most of real life use cases. Convenience is what really matters when it comes to Swift.

msk-lywenn 5 hours ago | parent [-]

"feel like running a native app"? Swift apps are native apps, AFAIK

frizlab 2 hours ago | parent [-]

Depends what framework you link it with.

spencerflem 5 hours ago | parent | prev [-]

What's wrong with that? This is often a single CPU instruction and a lot of languages have support for it, including python

https://en.m.wikipedia.org/wiki/Hamming_weight

wslh 2 hours ago | parent [-]

It was a positive comment about Swift showing the batteries included there. It is not normal to have such high-level methods for low-level stuff like bits in an integer. Clearly logical operations and rotation is included in all popular languages.

spencerflem 2 hours ago | parent [-]

Python has bit_count() as of semi recently :)

But I gotcha now, mistook "I wonder" as "I suspect it's not"