ObjC is so hard to read!!! Meanwhile…
Nope, no issues here.
I'm stuck in Swift land for at least the next week, so expect a lot of moaning and groaning. There's for sure some parts that I like about it, if they had a version with maybe 1/4 of the features (i.e. needless complexity) I might actually say I'd enjoy using it.
Oh and bring back F*****' header files you crazy bastards!
@paul … but that was the worst part 🫣
@paul Oh gods no! 😱
@paul Hmm, I'd like to see dynamic, read only header files that are automatically generated from the main file so I can use them to skim the interfaces and generate errors when my code makes no sense
Yesterday's Swift week highlight was spending at least an hour trying to find the right annotations to tell the compiler/concurrency stuff what a couple methods do threading wise. Turns out I had the right combo from the get go but it’s broken in both Xcode 26.2/4 and fixed in the .5 beta. Couldn't tell in older Xcodes because Apple blocks old Xcodes from running in current OSes for "reasons”.
Swift's concurrency approach is emblematic of its complete lack of pragmatism. Runtime sees hey I think this code is running in the wrong thread (or context if you must) what do I do? Warn and ignore, because it's probably OK 99% of the time, nope. Warn and correct, because you have enough info to infer what is probably needed, nope. How about crash 100% of the time, yep, that's the one.
Generate Fix. “I’m removing the code.” Thanks AI!
See its not just me!
Just to prove that I don't always just complain, the Expand Macro feature of Xcode/Swift is pretty cool.
I spent a good part of this week fighting with Shortcuts. Shortcuts are conceptually simple, take a thing, give a thing. I don't know if I'm missing something fundamental (that's also not clearly documented anywhere) but what a freaking nightmare when "thing" isn't just a simple String/AttributedString. There's a Transferable protocol that's supposed to magically convert between types but the Shortcuts app doesn't seem to call it unless the user does extra stuff when passing variables around.

After fighting with it for literal days I ended up setting it to just take an AttributedString and return a “UnionValue" thing that is like documented in one web page and a WWDC link, both with incorrect explanation of how it should be used.

It still doesn't work like I think it should but it works mostly OK and at this point I give up working on a feature 1% of users will ever touch.

If I was a better developer, I'd create a test project and get it ready for talking to someone at WWDC (remotely) but I'm more ready to just wipe this from memory and forget it even exists. Rant fin.
@paul I’ve had an Apple employee tell me I wasn’t a good enough developer and I should be able to figure out all the details the documentation omits.
@timo Damn, I guess its good those sessions are remote, caused I'd probably have smacked their smug ass.
@jongary @paul it’s been a while, this was on Twitter. Something about tvOS, maybe TVML or HLS. Docs came out a year late. And he was like, well Netflix figured this out no problem on their own. Why couldn’t you?
@timo @paul plenty of frustration and stubbed toes working with AVFoundation.
@jongary @timo yeah I remember when HLS stuff first came out and I sure as hell could never get it working right 100% of the time. Don't think I ever remember seeing any docs.
@paul @jongary there was an Apple test server findable via Google that had a copy of Pirates of the Caribbean with all the undocumented stuff like HLS chapters.
@timo @paul Wow.. that's horrible. :(
@paul I talked to someone at WWDC and they just told me to file a radar and mention a specific person by name. I did that, 7 years later UIStackView is still bugged.
@inket true, I had a similar experience, still not fixed.

@paul The Shortcuts/App Intents API is so fucking inscrutable. And the documentation is too disjoint to fix that problem.

And/or I’m a dunce.

@caseyliss LLM helped a lot with that, but even it was totally lost a lot of times.
@paul @caseyliss imagine having to add support for it before LLMs were a thing :\
@brianmueller @paul @caseyliss With an inscrutable UI that wasn’t documented and that generated magic and hidden header files. :\\
@paul When it works. More often than not I find it just doing nothing.
@paul Humans out here making up new languages trying to save a couple characters typing 🙄 and now even the computer doesn't care about that if it makes things looks worse.
@paul And, I mean, can we really take Swift style seriously while we can’t have a clear public interface like with Objective-C .h header files… (yeah, I know, Xcode is supposed to be able to generate one for you, "lol”)
@paul “if developer makes strong statements about trivial coding style questions, just agree. Do not try to debate!”
@paul That's not just artificial intelligence, that's artificial wisdom. 🙌
@paul …I think I’ll stay on this version of Ivory
@paul There are domains where you probably want that (kernel stuff, secure code) and domains where leniency would be better. But Swift is everywhere.
@stevex 100% and even times where you want it (debugging) and times when you don't (AppStore).
@paul they reason about (other) developers like this: if they were any good they would be writing the swift core. So how do we force them to address their concurrency problems? Make it crash. They’ll have to sort it out then. It’s not pragmatism they lack, it’s an excess of self righteous arrogance. It’s just a bunch of language nerds who never build anything.
@paul “warn and ignore” will get ignored by nearly every developer even those with good intentions (especially with the spam factory that is revealed in Console.app). Not sure if "warn and correct" is feasible, you'd know better than me since I nope’d out. Crashing unambiguously is almost always the best option since the developer can more easily find and fix the issue. As annoying as it is, it's 1000x better than some very rare bug that can't be reproduced and only manifests visibly minutes or hours after the problem and potentially corrupts user data along the way.
@tjw yeah I understand the argument, I just never agreed with it, but then I also think messaging nil should be fine and still think addObject:nil shouldn't raise. I'm just extra bitter because I got bit by a crash even though nothing was really wrong issue in a not often used codepath because they decided to change how some stuff works in like the one Swift file I had.
@paul wait Ivory is Obj-C?
@paul Out of curiosity, how much if this is Swift's fault and how much the libraries?
@paul I've stayed on Swift 5 and been happy. The day I'm forced onto Swift 6 I'm sure I'll complain.

@paul « a version with maybe 1/4 of the features (i.e. needless complexity) »

That'd be Dart (what is used for Flutter).

@paul I used a similar example in a talk on how Cobol works. I said something like "Oh, you think Cobol is wordy, huh? Then what do you say about this code in a modern language calling a modern API?" Although come to think of it, my example might have actually been in ObjC…
@waltman syntax is always clearer on the other side.

@paul Here's the example I used:

NSString *yourString = [whitespaceString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet]];

NSString *yourString = [whitespaceString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];

I originally did this talk for a Perl conference. As you can imagine, the equivalent code is a LOT shorter in Perl. 😀

@waltman why twice or was it just examples of trimming differently.

@paul Are `whitespaceCharacterSet` and `whitespaceAndNewlineCharacterSet` two different constants in the API? I'm sure I just copied that from the API docs but I don't remember. In any event, in Perl you'd either use `chomp` or a very simple regex if you wanted finer control. That second command would be something like

$yourString =~ s/\s+$//;

in Perl.

@waltman the newline one is a superset of the whitespace one, so you only need to trim that. And while yeah that particular API is a bit long winded it's just a method that takes a single argument and returns something.
@paul @waltman Not if you want to retain the newline. (I’m assuming these are supposed to be two different examples)

@pdcawley @paul I thought the second example was supposed to trim the newline, so that's why I went with that example. My intention wasn't to give every possibility but just demonstrate what the equivalent Perl code might look like. It's easy enough to use a character class in your regex to remove anything you want.

That said, I'm having a hard time thinking of a case where I wanted to trim trailing whitespace and *not* also trim the newlines. Maybe it comes up more often in GUI programming than CLI tools?

@paul is there a super boost button on this thing? 10+ years in and I still don’t get this argument.
@chadpod @paul The Emperor’s New Clothes is strong with Swift. Unreadable. I only use it when there’s no other alternative, which is in surprisingly few places. I think I have 5 Swift files in my >2K source files. 😄