logoalt Hacker News

Advent of Swift

77 pointsby chmaynardlast Sunday at 8:04 PM25 commentsview on HN

Comments

ChrisMarshallNYlast Sunday at 11:54 PM

I've been writing Swift daily, since the day it was announced, and have shipped a number of apps, written in it.

I have learned to like the language. It's not perfect, but comes closer than most. I've written in a lot of languages, over the years.

My other language is PHP, which I use for my backend work. I've probably been writing that for over twenty years, but I still don't like the language.

As I was learning Swift, I started this series of posts[0]. It's still ongoing, but I haven't added anything in a while, and the language has progressed, since the earlier posts.

[0] https://littlegreenviper.com/series/swiftwater/

show 1 reply
antfarmlast Monday at 1:51 AM

I did Advent of Code 2024 in Swift in a functional style, without using mutable state, custom data types (i.e. classes or structs) or loops.

https://github.com/antfarm/AdventOfCode2024

kris-slast Sunday at 9:32 PM

>The string processing is powerful, but inconvenient when you want to do things like indexing by offsets or ranges, due to Unicode semantics. (This is probably a good thing in general.)

This is being too generous to Swift's poorly designed String API. The author gets into it immediately after the quote with an Array<Character> workaround, regex issues, and later Substring pain. It's not a fatal flaw, a language backed by one of the richest companies in the world can have few fatal flaws, but AoC in particular shines a light on it.

I really like Swift as an application/games language but I think it unlikely it can ever escape that domain.

show 3 replies
ChefboyOGlast Sunday at 9:52 PM

I'm curious, in what niches are people using Swift for new applications these days? I've enjoyed working with Swift in the past (albeit in very limited capacities), but I haven't personally come across any Swift-based initiatives in a while. I had high hopes for Swift for TensorFlow, but it was ultimately killed off.

show 4 replies