Flinging poo in Swift

Thanks to one of the genuine upsides of Swift, full Unicode support in the compiler itself, you can do: enum EmojiErrors: Error { case 💩 } let 💩 = EmojiErrors.💩 Finally you can express yourself honestly within your program: throw(💩) Or, if you prefer to be polite & British about it: func flinging<E: Error>(_ error: … Read more

ambiguous reference to member ‘joined()’

You can readily tell that Swift was created by a C++ fanatic, by its fucking obtuse error messages. ⤹ Me             Swift compiler ⤵︎ In today’s episode of “what the fuck do you want, compiler?”, we tackle: foo.swift:186:39: error: ambiguous reference to member ‘joined()’ log.debug(“\(thingies.joined(separator: “, “))”) ^~~~~~~~ Swift.BidirectionalCollection:27:17: note: found this … Read more

Swift’s String.write(toFile:…) can’t handle tildes

let path = “~/Desktop/sigh.txt” try “WTF?”.write(toFile: path, atomically: true, encoding: .utf8) Result?  Explode: Error Domain=NSCocoaErrorDomain Code=4 “The folder “sigh.txt” doesn’t exist.” UserInfo={NSFilePath=~/Desktop/sigh.txt, NSUserStringVariant=Folder, NSUnderlyingError=0x1018110b0 {Error Domain=NSPOSIXErrorDomain Code=2 “No such file or directory”}} And since there’s no documentation on that write() method, and this is obviously a perfectly reasonable request that can’t sanely yield that bizarre … Read more