41 votes

Apple is killing Swift

19 comments

  1. earlsweatshirt
    (edited )
    Link
    Found this to be an interesting read. As a daily writer of Swift I do have my concerns with the sheer number of different keywords and features added in over time. I find that Swift (and SwiftUI...

    Found this to be an interesting read. As a daily writer of Swift I do have my concerns with the sheer number of different keywords and features added in over time. I find that Swift (and SwiftUI as well) are increasingly less discoverable as the number of magical keywords you couldn’t possibly know about without being told grows.

    Hell, the things they did to Swift itself to make SwiftUI’s syntax possible are already questionable.

    15 votes
  2. [8]
    talklittle
    Link
    Huh, I'm glad I haven't been exposed to most of that. Only really need like 20% I'm guessing. Swift is a really nice language when doing basic UIKit stuff as I have. Better than Kotlin IMO. It's...

    Huh, I'm glad I haven't been exposed to most of that. Only really need like 20% I'm guessing. Swift is a really nice language when doing basic UIKit stuff as I have. Better than Kotlin IMO. It's funny the author gave a favorable impression of Kotlin, when I feel Swift is actually more enjoyable to use. I guess when people are so deep into a technology they can find myriad faults with it.

    There's too many ways to do things in Kotlin; they went down this path the author is ranting about before Swift did IMO. When I think Swift, I think pleasure to read and write. Kotlin is more of a "write-first" language where it's easy to bang out some code, but reading others' Kotlin can be a pain. When there's too many options for how to write things, people like to try to get clever and play code golf.

    On the other hand, Java is arguably a pain to write with so much boilerplate (although IDEs and code generation have made up for that), yet is quite straightforward and pleasant to read, since it's such a simple language.

    Swift is best of both worlds IMO. It's no wonder all the modern languages copy bits from it.

    (By the way nice to see you posting here! Hope things are going well.)

    11 votes
    1. rkcr
      Link Parent
      Have you worked professionally in Kotlin? I've done years of it professionally and your analysis feels very off the mark. Maybe you worked with people who like to write overly clever code? (Those...

      Kotlin is more of a "write-first" language where it's easy to bang out some code, but reading others' Kotlin can be a pain. When there's too many options for how to write things, people like to try to get clever and play code golf.

      Have you worked professionally in Kotlin? I've done years of it professionally and your analysis feels very off the mark. Maybe you worked with people who like to write overly clever code? (Those people exist in every language).

      I can't speak to Swift vs. Kotlin because I have not developed Swift myself.

      9 votes
    2. feigneddork
      Link Parent
      I've used both Kotlin and Swift in a past role - Kotlin for some backend stuff, and Swift for a iOS RTMP library. I've found Kotlin to be great at the time as it's "Java, but what if Java was more...

      I've used both Kotlin and Swift in a past role - Kotlin for some backend stuff, and Swift for a iOS RTMP library.

      I've found Kotlin to be great at the time as it's "Java, but what if Java was more C#" - i.e. a cut-down less verbose version of Java. I personally dug it at the time, but I saw a project that was entirely written in Kotlin, and there was many, many classes in one file which just made me appreciate Java's one file one (main, non-static) class structure. The codebase was a mess, and as much as I liked Kotlin, I think it's something you really need to sit down and really agree on coding styles beforehand if you are working with multiple people because it's really easy to make a mess.


      Swift on the other hand. Yeesh. I did not have a good time with Swift. Admittedly I was dealing with RTMP code so this was byte manipulation and string manipulation as well as trying to manage concurrency - like all of the poorly developed aspects of Swift - but I still have my negative impressions.

      Because I came from Java/Python world to Swift, Swift felt like Apple made Python, but their way. Apart from the common if/else and for loops, it really felt like Apple/the designers of Swift tried to make unique features that didn't feel all that necessary. For example, take guard - that's literally an if (!condition) {} statement in syntactic sugar. I kind of felt like it was supposed to be used for nullabillity though (the Kotlin equivalent but just for nullability IIRC is someThing?.let { //code to run if not null } ?: { //code to run if null }).

      String manipulation was a pain - look at this monstrosity of an answer that explains how to substring. Also bear in mind I was working on Swift 2 code and had to migrate to Swift 3 code.

      If you've never worked with Swift, every major(ish) version was effectively a breaking change (at least from what I remember from 2 -> 3 and I think even 3 -> 3.5?), and the way you had to migrate was to use Xcode to automatically detect deprecated code and let it "fix" your code, although in an attempt to fix your code it could end up breaking it. This used to happen to me all the time with the byte manipulation code, and I would have to google stack overflow instead, find the answer, rewrite it, and use Xcode's "fix" tool to guide me through the broken code like I'm surfing on a wave of broken tides to find the next botched bit of code.

      I think the article explains how concurrency was never really implemented. It's genuinely shocking that it hasn't been a priority to this day - Apple chips with all their cores, you'd think they would want to utilise that power more, but what do I know.

      After about a year or two writing and maintaining Swift code, I decided to take the plunge and learn Objective C. Imagine the surprise of my life when I found Objective C to be a lot more fun to learn due to:

      • Literally decades of documentation from Apple and third party developers compared to the fleeting amounts of documentation on Apple's website - I've looked up AVAudioPlayer on Apple's documentation and honestly it looks a million times more better than it did before - I remember very, very sparse info like the documentation was auto-generated from the functions of the class and with minimal wording. This looks very helpful now, and I would've killed for stuff like this rather than Apple Developer videos where the dev talks about playing low latency video in an half an hour video with no transcript.
      • A clear explanation of Apple's thread delegation stuff (effectively previous point)
      • Once I developed in it, the syntax wasn't too horrible. I mean, sure, it is bastardised C, but for bastardised C, it was pretty good syntax.

      Eventually I moved away from mobile development altogether. Apple's and Google's grip on the market means you are effectively forced to push something new at least every year (even if your app is OK and doesn't need updates). Meanwhile, making a website is cheap, hassle free, and you can do whatever you like and charge whatever you like, using whatever payment means you like (Paypal, Stripe, etc).

      (Sorry for this long rambling post, this whole post bought back memories. If you've enjoyed Swift, good on you, and I hope it continues to serve you well.)

      9 votes
    3. Akir
      Link Parent
      I've been doing a lot of coding in lua for a video game engine I'm working on and boy, does it make me miss Java with it's beautiful objects with automatically written get and set methods, and...

      I've been doing a lot of coding in lua for a video game engine I'm working on and boy, does it make me miss Java with it's beautiful objects with automatically written get and set methods, and IntelliJ even could make class diagrams automatically so you could easily understand the code. It was an elegant tool from a far more civilized time.

      7 votes
    4. [3]
      ButteredToast
      Link Parent
      I write a lot of Swift and Kotlin for work and I have a pretty strong preference for Swift. This might just be bias since I’ve been writing Swift for a few years more than I have Kotlin, but I...

      I write a lot of Swift and Kotlin for work and I have a pretty strong preference for Swift.

      This might just be bias since I’ve been writing Swift for a few years more than I have Kotlin, but I find Kotlin kind of awkward. It dies on some weird hills with its syntax choices that sometimes feel like they’ve been made with just for uniqueness’ sake, and while the way it handles null checks can be nice sometimes, it doesn’t work just often enough that it makes me wish it had Swift’s if let. I miss guard often too.

      Also, I find that Kotlin is dragged down by Java ecosystem baggage to a far, far greater degree than Swift suffers from its Obj-C compatibility/heritage. My exposure to Kotlin is primarily through Android development and so most often for me this manifests in wanting to throw gradle and proguard out the nearest top floor skyscraper window.

      7 votes
      1. [2]
        bme
        Link Parent
        Building for android is its own special hell. Building software for the JVM in general on the server side can be quite pleasant if you restrict your dependencies.

        Building for android is its own special hell. Building software for the JVM in general on the server side can be quite pleasant if you restrict your dependencies.

        4 votes
        1. ButteredToast
          Link Parent
          Yeah, I don’t doubt that though I’ve never worked with anything JVM-based serverside. The extra control you get in that environment relative to Android goes a long way.

          Yeah, I don’t doubt that though I’ve never worked with anything JVM-based serverside. The extra control you get in that environment relative to Android goes a long way.

          3 votes
    5. earlsweatshirt
      Link Parent
      Yep, this used to be the biggest draw of Swift for me. Nowadays, I’m not so sure… There’s so much going on with macros, property wrappers, result builders and other newer Swift features where I...

      When I think Swift, I think pleasure to read and write

      Yep, this used to be the biggest draw of Swift for me. Nowadays, I’m not so sure… There’s so much going on with macros, property wrappers, result builders and other newer Swift features where I think it’s frankly quite unreadable - macros and property wrappers in particular explicitly hide a lot of what’s happening from the programmer using them unless you really dig into them.

      That’s not to say I think it’s a bad language, it’s still probably my favorite language I work with. But, I hope that some of these new features are stepping stones to something better.

      A funny comment I saw on Reddit about Swift 6:

      i feel like with swift6 they killed the simplicity of swift everyone loved. Fk u @escaping @Sendable @MainActor @autoclosure () async throws -> Bool!

      An exaggeration to make a point, perhaps, but a little too close to the truth for me :)

      (And thanks. The same to you :)

      3 votes
  3. eggpl4nt
    Link
    Great article, really informative about the history/trajectory of Swift and also just fun various bits and bobs of tech (like I didn't know Python was named after Monty Python, hah), and I enjoyed...

    Great article, really informative about the history/trajectory of Swift and also just fun various bits and bobs of tech (like I didn't know Python was named after Monty Python, hah), and I enjoyed the humorous undertones the whole way through. Thanks for sharing!

    4 votes
  4. [2]
    IsildursBane
    Link
    Really interesting article, although I find the title to be ambiguous and I initially misread it. There are two ways to interpret the title: Apple is actively killing Swift. This active killing is...

    Really interesting article, although I find the title to be ambiguous and I initially misread it. There are two ways to interpret the title:

    1. Apple is actively killing Swift. This active killing is done by discontinuing support/development and no longer using it as the language for development in the Apple ecosystem. This was the way I initially read the headline
    2. Apple is passively killing Swift. This passive killing could be by mismanagement, or changing the goals and benefits of the language. This is what the article is actually about
    4 votes
    1. PunchTunnel
      Link Parent
      Agreed. Reading 1 is news, and what I was interested to come read about - I'd be thrilled to hear of an upcoming paradigm shift for iOS development. 2 is basically an opinion piece, which is what...

      Agreed. Reading 1 is news, and what I was interested to come read about - I'd be thrilled to hear of an upcoming paradigm shift for iOS development. 2 is basically an opinion piece, which is what we got, and leaves me reaching for more coffee.

      2 votes
  5. [3]
    ButteredToast
    Link
    I share some of the author’s concerns, but the thing is for me is that if it turns out that Swift is declining in a way that can’t be reversed, I’m not sure what other language I’d use as a...

    I share some of the author’s concerns, but the thing is for me is that if it turns out that Swift is declining in a way that can’t be reversed, I’m not sure what other language I’d use as a replacement for desktop/mobile native end-user app development. It strikes a balance that few other languages do… Rust has gnarly looking syntax and doesn’t seem conducive to old style imperative UI toolkits (at the very least, its community seems infatuated with declarative, reactive, and/or immediate mode toolkits), Go is minimalist to its detriment, Kotlin is kinda odd and brings JVM baggage, C#’s UI situation is splintered beyond belief, Dart is coupled to Flutter which is way too mobile-dominant for my taste, Python is a pain to reliably pack up and distribute, JS has never been my cup of tea, etc etc.

    SwiftUI is a bit of a different story. I find it excellent for small components like list/collection view cells as well as grid-like screens, but it rapidly frays as UI complexity and nuance increases. I’ve seen several devs switch back to AppKit/UIKit-first, using SwiftUI only where it’s simple and beneficial to do so.

    4 votes
    1. [2]
      Minori
      Link Parent
      Arguably this is a good thing that shows Rust is taking active steps to encourage good, robust applications. It's a pain to learn a paradigm shift, but sometimes the new ways are better?

      Rust has gnarly looking syntax and doesn’t seem conducive to old style imperative UI toolkits (at the very least, its community seems infatuated with declarative, reactive, and/or immediate mode toolkits)

      Arguably this is a good thing that shows Rust is taking active steps to encourage good, robust applications. It's a pain to learn a paradigm shift, but sometimes the new ways are better?

      1 vote
      1. ButteredToast
        Link Parent
        It’s a bit difficult to tell right now because Rust’s UI toolkits are still missing widgets, and in general I’ve not come across any reactive UI toolkit that is able to compete toe-to-toe with the...

        It’s a bit difficult to tell right now because Rust’s UI toolkits are still missing widgets, and in general I’ve not come across any reactive UI toolkit that is able to compete toe-to-toe with the old guard toolkits like AppKit, win32, MFC, GTK, etc in terms of stock widget set and capabilities. It’s not just a paradigm shift, it’s that these newer frameworks aren’t conducive to many common types of desktop apps.

        As for syntax, it’s intimidating looking and I believe scares away a lot of devs.

        2 votes
  6. [4]
    donn
    Link
    I have mixed feelings. I love Swift. But I think I can definitely agree with the bloat. SwiftUI, especially, was the first "what's going on" moment where it felt like I was writing a weird alien...

    I have mixed feelings. I love Swift. But I think I can definitely agree with the bloat. SwiftUI, especially, was the first "what's going on" moment where it felt like I was writing a weird alien language, except that alien language was still somehow valid Swift. Never got into it.


    As a side note, thinking about it my continuous biggest issue with Swift is, more than anything, how it relies on unwieldy NeXTStep APIs to accomplish some things I consider basic.

    Subprocesses are still a nightmare for example, see the Motivation section of this Swift Foundation evolution. Ditto regular expressions, which until I want to say 2023? you had to convert your String to NSData to use for some reason. Things like that. They do add up.

    3 votes
    1. [2]
      Akir
      Link Parent
      I definitely get that "alien language" comment. I tried briefly to make an iOS app to stream music from BattleOfTheBits, figuring that Apple is known to be fairly good to developers and it should...

      I definitely get that "alien language" comment. I tried briefly to make an iOS app to stream music from BattleOfTheBits, figuring that Apple is known to be fairly good to developers and it should be easy to figure out Swift and their way of doing things. But coming from years of working with Javascript and PHP before that, just dealing with HTTP requests was a nightmare. It felt like I was trying to build a server, and the example code Apple provided basically needed you to already be an expert at Swift syntax because it had what felt like random unexplained punctuation everywhere, each of which was actually a small complication that required additional code to deal with, which was beyond the scope of the example code provided.

      Of course, it wasn't entirely impossible to understand, and once I grasped all the loose ends it all seemed reasonable to handle things that way, but it was so much to deal with at once for something that was relatively trivial in my previous domain that it basically felt like being dropped in a foreign country with nothing but a phrasebook to help you communicate with the locals.

      3 votes
      1. donn
        Link Parent
        Was… talking specifically about Swift UI. Swift's optionals syntax which I think you're referring to has a steep learning curve but is quite powerful afterwards

        Was… talking specifically about Swift UI. Swift's optionals syntax which I think you're referring to has a steep learning curve but is quite powerful afterwards

        2 votes
    2. earlsweatshirt
      Link Parent
      Yeah SwiftUI is.. weird. Once you understand result builders it makes sense but tbh I don’t know why they had to add that at all. Chris Lattner said it best when he said it feels like SwiftUI was...

      Yeah SwiftUI is.. weird. Once you understand result builders it makes sense but tbh I don’t know why they had to add that at all. Chris Lattner said it best when he said it feels like SwiftUI was designed to write code that looks good on a powerpoint slide (From this great interview: https://youtu.be/ovYbgbrQ-v8?si=NL_7yUlydZNVXBhm)

      2 votes