12 ms·
Swift 6
- jph 2y agoSwift 6 is a major leap forward for cross-platform batteries-including development IMHO. Foundation is the big win here, because it provides so much out of the box. Swift 6 is the first version with enough low-level improvements and cross-platform capabilities to make me curious if the Swift team is trying to aim for long-term replacing C, C++, Rust, Zig, etc.
- refulgentis 2y agoBeen using Swift since the pre-release announcement that it existed. O'Leary's Law of Swift Comments on HN, much like Betteridge's Law of Headlines, says the answer to Swift speculation on HN is always no. If there is any global aim, it is to migrate internal teams still working in ObjC/C++ to Swift. If this sounds close-minded, it's worth talking with an iOS developer 1:1 and get info on the day-to-day experience of SwiftUI 5 years in, and concurrency/actors 3 years in. They have a lot of fires to fight to keep the house standing.
- favorited 2y ago> Apple is not trying to potentially attempt to aim for maybe replacing every other programming language with Swift Apple's stated goal is to make Swift a viable language up and down the technology stack, which goes way beyond Objective-C. They are actively working on making Swift viable in baremetal environments, firmware, drivers, etc. IIRC they even referred to it as a C++ successor language at WWDC this year. I agree that they're not trying to "replacing every other programming language," but they're investing in it becoming a viable language choice in most environments.
- refulgentis 2y ago> they even referred to it as a C++ successor language Nice! I'd gently warn against parsing that too closely: having been in the community and the weeds starting in 2014(!). ex. the cross platform Foundation was announced and open sourced in 2016. I'm sure a lot of things were upgraded or more consistent and its better etc., but it's a painful to remember what was expected + communicated at the time, and how much later it is.
- tcmart14 2y agoWhich I think that makes sense for them to want it to be viable all over the stack. It also directly benefits them also. I am assuming a lot of the motivation for embedded swift is being able to use it in their own stacks. I think even the presentation for WWDC gave examples of it being used in some pieces of hardware like on the AppleTV?
- rudedogg 2y ago> They are actively working on making Swift viable in baremetal environments, firmware, drivers, etc. I don’t think Swift has a place in these niches FWIW. Writing low-level Swift code is very verbose and unnatural. Personally I just don’t think it’s practical to have a single language excel across the stack.
- newaccount74 2y agoI think the goal of Swift on the server, or embedded Swift, is mainly to offer Mac and iOS developers a way to write everything in the same language. Right now, my Mac app depends on a few simple web services that are written in a different language. It would be neat if those services could be written in Swift, so that I could just use the language I already know instead of relearning how to do decode JSON in Python/Ruby/PHP. Swift on the server doesn't have to become widely used. As long as there is a simple way to write basic web services, it is useful.
- pzo 2y ago> It would be neat if those services could be written in Swift, so that I could just use the language I already know Then somebody else would have to now learn Swift even thought they write in different language like: Android Developers (Kotlin/Java), React Native devs (JS/TS ), Windows Devs, Linux Devs etc. As long as Apple don't invest more in official cross-platform tooling Swift is not gonna be mainstream (even though I like Swift). They have to bless other competing platforms.
- newaccount74 2y agoI was more thinking of smaller teams or individual developers that are Apple only. If you have a bigger team, then it doesn't matter as much, because you have different people who do the iOS app, people who do the website, people who do the back end etc. Swift on the server doesn't have to go mainstream to be useful. If you just need some basic web service that syncs highscores or verifies in-app purchases then it would be neat if you could write that in the same language as the app itself.
- myko 2y agoJohn McCall (Swift team) gave a talk on Swift replacing C++ earlier this year: https://www.youtube.com/watch?v=lgivCGdmFrw https://www.youtube.com/watch?v=lgivCGdmFrw Selfishly I wish mixed C targets were a priority before C++ but I get why this was more important to them
- mpweiher 2y agoHuh? Objective-C was in the kernel.
- lukeh 2y agoIn NEXTSTEP, yes, but not macOS.
- mpweiher 2y agoAnd they regretted the decision not to do it in macOS.
- MBCook 2y agoWas it? Objective-C requires a runtime. I thought the kernel was always C/C++.
- favorited 2y agoThere is code in the kernel to enable treating types like `os_log_t` and Clang blocks as Objective-C objects higher up the stack, but the XNU kernel itself is almost entirely C and C++.
- mpweiher 2y agoYeah, on macOS. On NeXTStep / OPENSTEP kernel drivers could be and were written in Objective-C. https://www.nextcomputers.org/files/manuals/nd/OperatingSystem/Part3_DriverKit/Reference/Classes/IntroDriverKitClasses.htmld/index.html https://www.nextcomputers.org/files/manuals/nd/OperatingSyst...
- KerrAvon 2y agoNeXTstep 3.3 supported Objective-C drivers in the kernel. Mac OS X's IOKit changed them to use a (poorly defined/maintained subset of) C++.
- MBCook 2y ago
- saagarjha 2y agoApple says a lot of things at WWDC. Not all of them are entirely honest.
- MBCook 2y agoDo you have any evidence they’re not targeting it as their main everywhere language? It’s already been used in their libraries, their OSes, and even firmware on embedded processors.
- saagarjha 2y agoI think this conversation has a lot of parallels to their public views on SwiftUI. Are they working on it? Yes. Will it maybe end up being what they consolidate around sometime in the future? Maybe. Does that mean you should believe them when they say it’s the biggest thing you should invest in right now? No.
- MBCook 2y agoThey’re pretty clear on both. UIKit, AppKit, and Objective-C(++) aren’t getting new features except in rare cases. This is the way forward. And they’re dogfooding it. Even in some of their embedded processors.
- lapcat 2y agohttps://live.arstechnica.com/apples-wwdc-2014-keynote/images/IMG_0018.JPG https://live.arstechnica.com/apples-wwdc-2014-keynote/images...
- Verdex 2y agoI feel like the whole issue with c++ is that in order to create a language able to do everything you more or less have to include a feature set that is 'unharmonious' to say the least. To me it kind of feels like swift's place here is going to replace the subset of c++ that apple is mostly interested in. But not necessarily the c++ that they aren't and then likely not the c++ that rust et al are able to replace (although I guess we'll see what they have in mind as time goes by). I suspect they'll be disappointed if they try to replace c++ in totality. As the end result will likely not be particularly habitable.
- MBCook 2y ago> I suspect they'll be disappointed if they try to replace c++ in totality. Why is that? That is their aim, I think they’ve made it clear. They’re writing all-ish new code in Swift (not always practical in existing code) from what I understand. They’re already using it for the code that runs in places like the Secure Enclave or other embedded processors. Can it replace C++ 100% everywhere today? Probably not. I don’t know enough to know why. But that absolutely appears to be the goal.
- multimoon 2y agoThe most batteries included multiplatform language right now is _by far_ Kotlin and nothing else is remotely close. The ecosystem is amazing, the language itself is awesome and follows sane rules, you can chose between native code, JVM, WASM, or JS-IR, or all as backends to compile to (for the exact same code) depending on your use case. Compose Multiplatform is also wonderful and by far my favorite UI library now and I’ve shipped a fair bit of code with it. It’s a single UI library that I can share my UI across every platform (including iOS and android), and even seamlessly interop with native widgets on platforms like iOS if I need to, like the camera viewfinder for example. Kotlin’s real strength is the compilers ability to target as many different backends as you want and cross compile into any platform you want. I have an app in production that save for about three lines of swift that declares the view controller for iOS specifically, shares its entire codebase all in kotlin between Android, iOS, Mac, Linux, and Windows. I could add a line to the build file and add web as a target and turn it into a web app.
- jb1991 2y agoThe comment you are replying to was focusing more on the low-level features of Swift for systems programming (hence comparing it to systems languages). Kotlin is cool but it is not a system programming language and the native code compilation from Kotlin is not aimed to be.
- iainmerrick 2y agoThat earlier comment didn’t actually mention “systems” at all (although it does include “low-level”). I feel like “systems programming” is getting increasingly ill-defined these days, anyway. If Kotlin and Java aren’t allowed, how about Go? Are you ruling out all languages with garbage collection?
- refulgentis 2y agoYou're right to note systems programming doesn't involve GC usually
- MarcusE1W 2y ago
- WhitneyLand 2y agoIt’s too slow. I can’t stand waiting for builds on what I would call a medium sized project. I haven’t given 6.0 a full effort yet, but a couple test compiles without any tuning showed only incremental improvements.
- bsaul 2y agoAny idea if compiling for android ( at least the data part) will now be supported ?
- pjmlp 2y agoIf if it does, it isn't like using NDK and going through JNI for anything useful outside game development is that great experiece. People keep doing that, because I guess they hatred for Java and Kotlin is higher than the pain of using NDK.
- marcprux 2y agoI recently wrote about using a native Swift toolchain for Android: https://skip.tools/blog/native-swift-on-android-1/ https://skip.tools/blog/native-swift-on-android-1/
- pjmlp 2y agoLong-term replacement of C, C++, and Objective-C on Apple's ecosystem has been on Swift documentation as mission statement since day one. I don't get how people still get surprised by this.
- 6gvONxR4sf7o 2y agoEvery time I read about swift it seems like a nice language, but it's a shame its ecosystem is so limited. It's great to see it supporting more platforms now. Is the ecosystem in the package manager/index also heading the same direction?
- tcmart14 2y agoFor the question, I think it depends on what you mean. I've been able to use SwiftPM on linux without a whole lot of issue. So SwiftPM itself doesn't seem to be the blocker here. At least I've not had issue in my experimentation. What is maybe more of the blocker is the number of libraries that are useful and are compiled and tested on Linux. Which for that, the solution is just people write libraries/upstream Linux support to existing libraries.
- MBCook 2y agoMaking more and more of foundation available (a big part of 6) should also help a lot. Fewer external dependencies needed, and fewer per-platform libraries if you support multiple platforms.
- tcmart14 2y agoYes it should. I am excited for it, the big of swift on Linux that I've done, I have enjoyed and look forward to it getting better and better.
- deleted 2y ago[deleted]
- alas44 2y agoExplained to a layman, how nice is this release? Is more platforms support gonna make Swift a first class langage?
- ezfe 2y agoThe biggest feature here in that regard is the static, Linux SDK and cross platform foundation library
- moomin 2y agoI’m honestly not usually that interested in feature lists for languages I don’t use, but this really does look quite compelling. Ownership semantics and C++ integration? Sign me up. I’d be interested to know how good this integration is in practice e.g. could it be used to integrate with Godot directly?
- rescripting 2y agoSomething like this? https://github.com/migueldeicaza/SwiftGodot https://github.com/migueldeicaza/SwiftGodot > SwiftGodot can be used to either build an extension that can be added to an existing Godot project, where your code is providing services to the game engine, or it can be used as an API with SwiftGodotKit which embeds Godot as an application that is driven directly from Swift. Miguel de Icaza gave a great talk on Swift + Godot (among other things) https://www.youtube.com/watch?v=tzt36EGKEZo https://www.youtube.com/watch?v=tzt36EGKEZo
- syndeo 2y agoSeconding this! I've ported a GMS2 project over to SwiftGodot, and it's been great to work with. As I ported over the code, the Swift compiler even caught a bug or two that I'd missed back when it was written in GML!
- moomin 2y agoI guess my question is how much a custom bridge is needed with the C++ integration. (I understand the bridge will always be better in some sense, but I’m also interested in what it would be like to just ignore it and target the C++ API directly.
- Someone 2y ago> I’d be interested to know how good this integration is in practice I haven’t used it, but from looking at the long) video at https://youtu.be/ZQc9-seU-5k?si=JMFCWKUZ0vVtst9K https://youtu.be/ZQc9-seU-5k?si=JMFCWKUZ0vVtst9K (discussed in https://news.ycombinator.com/item?id=38444876 https://news.ycombinator.com/item?id=38444876), it looks pretty good.
- 2y ago
- bogidan 2y agoThe download sizes are quite large. 775 MB for swift-6.0-RELEASE-ubuntu22.04.tar.gz ~500MB for windows. Is this shipping an entire copy of LLVM? What could possibly make this so large?
- troupo 2y ago[flagged]
- derefr 2y agoCross-target toolchain support for shipping for all platforms from any platform? (Not sure that's in there, but if it were, it'd be large.)
- favorited 2y agoYeah, they contain binaries for Swift itself (the driver interface, the compiler, the repl, the package manager, swift-format, etc.), as well as the toolchain's dependencies (llvm, lldb, clang, the sanitizer runtimes, etc.). There are other (also large) downloads to enable producing static binaries on Linux, and those contain the required system libraries (musl libc, libicu, libcrypto, libpthread, etc.). Those are about twice as big as they need to be, because they bundle x86 and aarch64 together.
- jonathanyc 2y agoI only want one feature from Swift: faster type-checking. If you write a few lines of math, or a moderately complex SwiftUI expression, suddenly the typechecker starts timing out. Swift is the only language I've ever used with this problem. https://hachyderm.io/@evanw/109859384302551859 https://hachyderm.io/@evanw/109859384302551859 https://www.cocoawithlove.com/blog/2016/07/12/type-checker-issues.html https://www.cocoawithlove.com/blog/2016/07/12/type-checker-i... https://danielchasehooper.com/posts/why-swift-is-slow/ https://danielchasehooper.com/posts/why-swift-is-slow/ This isn't mentioned at all in the announcement so I'm kind of disappointed.
- refulgentis 2y agoI wouldn't expect it, ever, frankly. Seen multiple Apple people come and go while explaining how they were going to solve that (c.f. 2016(!) for link #2)
- zengid 2y agoChris Lattner recently explained that because of function overloads (and other features), type inference is really hard to make fast in Swift, and is why he says that "using Hindley-Milner was a mistake". [0] [0]: https://youtu.be/ENviIxDTmUA?si=FavjcK8IQygnlIwT&t=4417 https://youtu.be/ENviIxDTmUA?si=FavjcK8IQygnlIwT&t=4417
- saagarjha 2y agoI don’t think Swift uses Hindley-Milner though?
- w10-1 2y agoIt's a fair point, but radically different 8 years on. Swift type inference is two-way, so you can often improve things by annotating types instead of using inference. Also, it very easy to have complex builders and nested closures that complicate inferencing, so it's a bit of a side-effect of how much people use the powerful features. The big compile-time gotcha now is using macros. To be safe, each macro runs in its own process hogging cores, and the new Xcode compile scheduler isn't quite sensitive to that, so sometimes command-line builds with less parallelism are a fair bit faster. The solution there is judicious use, particularly of libraries depending heavily on macros.
- dmart 2y agoWith safe concurrency and typed throws, Swift is starting to look a lot like a friendlier Rust to me. Honestly pretty excited to take a look at it again, though I doubt it will become my daily driver due to the smaller package ecosystem. Hopefully cross-platform Foundation is a step towards improving that though.
- steelbrain 2y ago> Swift is starting to look a lot like a friendlier Rust to me. That’s what i thought and rewrote my cli util in swift. Ran great on macOS, tried to build for windows and found out there’s no well maintained, actively developed http server for windows for swift. Dont let these wooing crowds fool you
- asplake 2y agoHa! That seems to answer my next question: what’s its story for web development? Does it have one?
- myko 2y agoVapor works great on Linux and macOS. Haven't tried Windows (pretty much only run Steam there these days)
- alexashka 2y agoYou can't compile for Linux from XCode (defacto IDE for all things Apple) and all web dev runs on linux. If you like having an IDE instead of scrolling multi-page compiler error dumps in your terminal window - this is a complete non-starter. The leading Swift web framework (Vapor) suggests you use Docker to build for Linux. I gave it an honest try - their empty starter 'hello world' web server takes more than a minute to compile. Ok, but surely it'll be faster after I make a one liner change? No - their docker workflow has 0 compiler caching - you'll be waiting more than a minute every time. Complete non-starter. I ended up installing a VM, installing the swift compiler and that only takes 2-3 seconds to re-compile a 1 liner change (in a print statement, in an empty project, lol). Consider me very deeply unimpressed. By comparison - a visual studio code + docker + python/ruby/javascript setup is a well oiled, working machine.
- skrrtww 2y agoI wish they would stop introducing more magic syntaxes.
- schrodinger 2y agoI agree! I'm a Go programmer, and while I do wish it had some more features at times, Swift is an example of how it can easily go out of control and ruin a promising language. For example tests, there's so much magic. How do I know it runs the test for each item in the arguments array? What if there were multiple arguments? After using Go for close to a decade now, I'm really seeing the wisdom of avoiding magic, and making your testing code the same language as your building code! Compare: Swift: @Test("Continents mentioned in videos", arguments: [ "A Beach", "By the Lake", "Camping in the Woods" ]) func mentionedContinents(videoName: String) async throws { let videoLibrary = try await VideoLibrary() let video = try #require(await videoLibrary.video(named: videoName)) #expect(video.mentionedContinents.count <= 3) } Go: func TestMentionedContinents(t *testing.T) { tests := []struct{ Name string }{ {"A Beach"}, {"By the Lake"}, {"Camping in the Woods"}, } for _, tt := range tests { video, err := library.FindVideoByName(tt.Name) if err != nil { t.Fatalf("failed to get video: %v", err) } if len(video.MentionedContinents) > 3 { t.Errorf("video %q mentions more than 3 continents", tt.Name) } } } Go with timeout handling in case the FindVideo function takes too long (idk Swift magic well enough to know if it'd do this automatically!) func TestMentionedContinents(t *testing.T) { tests := []struct{ Name string }{ {"A Beach"}, {"By the Lake"}, {"Camping in the Woods"}, } for _, tt := range tests { t.Run(tt.Name, func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Millisecond) defer cancel() video, err := library.FindVideoByName(ctx, tt.Name) if err != nil { t.Fatalf("failed to get video: %v", err) } if len(video.MentionedContinents) > 3 { t.Errorf("video %q mentions more than 3 continents", tt.Name) } }) } }
- rescripting 2y ago> How do I know it runs the test for each item in the arguments array I mean the APIs aren’t magic; you can “inspect macro” to see what code is generated at compile time which boils down to something similar to the Go code with better ergonomics.
- akoncius 2y agodid not find anything metioned about namespaces/packages support? quite disappointing :( this is the main disadvantage for my tastes
- hombre_fatal 2y agoThe unqualified imports are definitely a major pain point. In a large Swift app I find myself having to be eternally vigilant organizing my files so that I'm not dumping surprises into the import site. Makes me appreciate how even Node.js got it right so early on.
- throwitaway1123 2y agoI also disliked unqualified imports. I can never get used to languages where you can 'import foo' or 'use foo' and it just dumps a bunch of symbols into the current scope. That combined with Swift's 'implicit member expressions' makes it difficult to read code outside of an IDE (although I understand why they made that tradeoff given some of the long identifiers Swift inherited) [1]. [1] https://github.com/Quotation/LongestCocoa https://github.com/Quotation/LongestCocoa
- seanw444 2y agoWhat platform has 128-bit integer support to where that was an important thing to add to the primitive types?
- bluepizza 2y agoIPv6 and ZFS use 128-bit integers - I suspect this is why this primitive was added.
- stephencanon 2y ago(Author and implementer of the Swift Int128 proposal here) There's lots of one-off uses for 128-bit integers scattered around systems programming (and programming in general, I just happen to come from more of a systems background). Individually using a pair of 64b integers for each case is totally workable, but eventually life is easier if you just have an Int128 type. There's not really any one use case that drove their inclusion in the standard library, rather lots of times that we were saying "it would be kind of nice if we had this".
- easeout 2y agoThanks for your work!
- LegionMammal978 2y agoMany platforms have an instruction to get the upper 64-bit word of a widening 64×64-bit multiplication. But it can be difficult to (performantly) access such instructions from anything higher-level than assembly, so well-optimized language support for 128-bit integers can open this up.
- stephencanon 2y agoSwift had made this available for a long time via multipliedFullWidth (SE-0104, implemented in Swift 4.0), no Int128 required. E.g.: https://godbolt.org/z/dvMefahdq https://godbolt.org/z/dvMefahdq
- Kelteseth 2y agoI recently tried SwiftGodot, because I found Swift for game Dev very interesting in comparison to csharps GC stalls. Sadly it does not yet support sharing pre build Windows development libraries[1]. Compilation does take quite some time, even on my beefy 16 core Ryzen. The changelog did mention multi threaded Swift package manager improvements on Windows though. [1] https://github.com/migueldeicaza/SwiftGodot/issues/521 https://github.com/migueldeicaza/SwiftGodot/issues/521
- syndeo 2y agoI've been using SwiftGodot lately too, and I'm quite enjoying it! iOS development is my day job, so it was great to port my old GMS2 project's codebase over to Swift, and suddenly have type-safety and no GC hiccups. During the porting process, the Swift compiler even discovered a couple of latent bugs for me!
- dur-randir 2y agoI've tried using it once and got compiler crash from the get go. Still no response on the bugtracker. Next try in 5 years.
- RivieraKid 2y agoSwift is great but I wish it had namespaces / packages...
- rubiquity 2y agoSwift has packages and a module system.
- w10-1 2y agoI think the complaint is the global runtime namespace, not source modules. Statics live forever, and extensions in any library on a type apply to all uses in the runtime (with no guarantees about conflicts). Mostly that's minimizable with good practice, but can be annoying to those used to hierarchical namespacing and static memory reclaimed after the class becomes unreachable.
- truncate 2y agoNo submodules however.
- astrange 2y agoProgrammers can't be trusted with submodules, as you can see from C#/Java and its standard libraries where everything is named like System.Standard.Collections.Arrays.ArrayList. Of course, taking them away doesn't stop them from other kinds of over-organization like ArrayFactoryFactoryStrategies, but it helps a little.
- truncate 2y ago"Programmers can't be trusted with..." isn't the best argument here IMO. You already gave one reason why. Programmers will create a mess regardless IMO, despite how nice the language is. Adding to that (1) among all he things I didn't like about Java, nested modules were least of it. (2) Lot of it has to do with how reference code in that ecosystem are written which are then adapted as standard practice. Its all good for stuff that do one thing, but if you are building things in same repo with several components, they are nice to have. Rust/Python/Racket are few languages I can think of which have submodules/nested modules and I've not heard people complain about that there.
- dtech 2y agoI'm not familiar with Swift, anyone already know how typed throws hold up? Checked exceptions are pretty universally seen as a mistake in Java [1] while ADT à la Result are generally perceived better. [1] See e.g. https://literatejava.com/exceptions/checked-exceptions-javas-biggest-mistake/ https://literatejava.com/exceptions/checked-exceptions-javas..., but also Java 8+ API's moving away from them.
- deleted 2y ago[deleted]
- airspeedswift 2y agoYou can read about the trade-offs in the language proposal here: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0413-typed-throws.md https://github.com/swiftlang/swift-evolution/blob/main/propo... In particular: > Even with the introduction of typed throws into Swift, the existing (untyped) throws remains the better default error-handling mechanism for most Swift code. The section "When to use typed throws" describes the circumstances in which typed throws should be used.
- brantonb 2y agoI think your link got cut off. Here’s the direct link to the section on when to use typed throws. I hadn’t read this before, and it changes how I’ll approach them. Thanks for pointing it out! https://github.com/swiftlang/swift-evolution/blob/main/proposals/0413-typed-throws.md https://github.com/swiftlang/swift-evolution/blob/main/propo...
- nielsbot 2y agoThrows in Swift are not traditional exceptions. A throwing function in Swift is actually a function that can return an error instead of a result. This is hidden by the language. So something like `func foo() throws -> Result` Is actually `func foo() -> Result | Error` The compiler also forces you to handle any returned errors using `try`. So to call our example `foo`, you'd do: `let result = try foo()` You must either handle any throws error or include this call in an enclosing throwing function.
- ChrisMarshallNY 2y agoI'm interested in seeing where Swift Testing goes.
- meindnoch 2y agoI'm gonna to say it: the Swift language had become a monstrosity.
- O-stevns 2y agoYup I agree, to me it is turning into the next c++ with the kitchen sink in terms of features. The language is trying too hard to cater to too many use cases. At some point I hope it stabilizes without it being the end of the language. I use Swift every day and while I still enjoy it, I think the language was nicer to use in its earlier iterations than it is now, which is a shame.
- meindnoch 2y agoI was hoping for the same about 2 releases ago. We're way beyond unsalvageable. If I was Chris Lattner, I would be lying in my bed wide awake each night, staring at the ceiling, wondering how it went so wrong.
- strongpigeon 2y agoI'm still fairly new at Swift and like it "OK" so far. One thing that I find particularly annoying however is how you very often run into "Compiling failed: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" when using SwiftUI... It's just shocking to me that the compiler is asking me to help it out.
- charliebwrites 2y agoSwiftUI errors in general are mostly unhelpful. It will go so far as to suggest a change in a thing only for the developer to find out the cause was completely unrelated or even in a model in a different file. Helpful error messages for SwiftUI would go a long way
- jakey_bakey 2y agoYou just gave me flashbacks to 1.0 in 2019
- ben_w 2y agoIn my case, Metrowerks CodeWarrior student edition in the late 90s, when I was going though "C for Dummies" in highschool. Miss a semicolon, every line after but not including the one with the error. ResEdit was better in the 90s than SwiftUI was in Xcode last year. Hoping to find that standard will be re-achieved when I install the update…
- deleted 2y ago[deleted]
- alexashka 2y agoAdmitting SwiftUI to have been a mistake and reinvesting back into AppKit and UIKit would go a long way. In what other industry does anyone use text to create visual layouts? We still do drag and drop to design the layouts anyway, followed by re-creating the drag and drop version... using text... It's all quite maddening if you try and make sense of it.
- w10-1 2y agoIt's super nice that they support moving up incrementally. Moving to Swift-6 mode with full data-race safety checks can be daunting. They wrote a separate post on that, and Holly telegraphed that they're still actively reducing noise, i.e., warnings where the compiler could use a bit more analysis to prove there's no race. The really nice thing is you can use the new tooling, but stay with the 5.10 version of the language that works for your code, and feature-by-feature add Swift 6 checking. You can build the same package under both language modes, so libraries can move ahead in their versioning while still supporting clients who are not ready.
- jamil7 2y agoI’m sort of in two minds. On paper, I think for greenfield projects data-race safety checking looks great. If I switch to thinking about my day job, I know we will likely never adopt Swift 6 for some of our components because they’d need to basically be rewritten, at which point we’d probably consider something more cross platform like Rust or Kotlin. So despite liking the feature on paper, I feel like the overhead it introduces in practice is kind of pushing me away from the language. It’s hard to say at this point though, adoption might get a lot easier with subsequent point releases.
- O-stevns 2y agoThe whole concurrency agenda with local reasoning sounds great in theory but in practice becomes such a pain in the ass for projects that has existed for years. Maybe our current app has unknown data race bugs, maybe not... with a crash free session percentage of 99.80% and hundreds of thousand monthly users, it's not something I consider a big enough problem, to the point where more friction to the language should be added to maybe fix it.
- jamil7 2y agoThis is pretty much the conclusion we also end up at, data race issues aren't our main issue right now, although zero would be a nice to have. Everytime I've tried out Swift 6 language mode I also feel like I'm sometimes appeasing or tricking the compiler rather than thinking about actual problems.
- keyle 2y agoI'm incredibly excited for this. I thought swift was basically going to be stuck on macOS. Last time I converted the swift compiler from the Ubuntu package to work on Debian, stuff was looking really awry. Most things work but not simple things like sigterm signals. Swift is a fantastic language. I think the most advanced and smart language today. And I say this having used over 20 professionally over 25 years. Just look at how swiftUI is implemented. It's not even a DSL, it's Swift naturally! Compare it to flutter and you'll see how incredible it is. (I do like dart too though) As for the language it's full of clever features and advanced ideas that don't suck to use and consider the developer real world use of the language. Two things really suck in swift though; compiler error messages are straight out of the university of assholery and documentation was crafted in Mordor probably. Of course most libraries probably won't work well on Linux yet but there is a future with the right balance between safety and speed and joy of developing.
- neillyons 2y agoI recently started learning Swift and Swift UI and was surprised at how complicated the language is. Especially regarding reactive instance variables. eg. @observableObject. Didn't understand it. There are like five different ways to do it. Ended up playing whack a mole until it worked.
- gavindean90 2y agoI had the same experience until I worked with swiftdata which was rather nice, especially by comparison.
- jamil7 2y agoIf you’re targeting newer OSs you can try the @Observable macro instead of ObservableObject. It fixes a lot of the weird problems with the latter (although does introduce some new, weird edge cases).
- SebastianKra 2y agoTBF, reactivity in UI is still basically an unsolved problem with frameworks going in circles between data-binding, dependency-tracking, memoization & compilation. SwiftUI initially promoted their ReactiveX alternative.
- jakey_bakey 2y agoSwift would be perfect if it wasn't dying a death by 1000 cuts thanks to the inherent conflict in its governance. Swift is caught between two clans: the Swift Working Group™ open-source community, and the Apple corporate entity who pays most of their salaries. Both have their own incentives and their own imperfections, but you guess who has the majority influence. Ridiculous, permanent, tech debt such as hardcoded compiler exceptions are permanently living in the compiler codebase. Even worse, half-baked concepts such as result builders are pushed through without any real discussion because Apple wants the SwiftUI syntax to look pretty. It's an amazing language still, but I can't see it surviving as nicely in the next 10 years if Apple doesn't learn to let go.
- riscy 2y agoCan you explain how result builders are half-baked? They’ve been used for more than SwiftUI by now. The Regex support since 5.7 uses them: https://www.hackingwithswift.com/swift/5.7/regexes https://www.hackingwithswift.com/swift/5.7/regexes
- cageface 2y agoBecause they rely on variadic generics they can make type inference very slow or just fail completely, leading to the infamous and singularly unhelpful compiler error, "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions".
- paperplatter 2y agoSwift is the only language where I've had to fight the compiler to do its job. In earlier versions like 1.x and 2.x, it would often segfault. By 3.x it was still really slow to build. I regretted moving a project off ObjC back then. I thought maybe that was all fixed by now, but guess not?
- cageface 2y agoOn paper Swift has a lot going for it. In practice it's easily the worst devx out of the modern languages. And SwiftUI is still so full of bugs and performance pitfalls I'm actually quite pessimistic about the future of native apps on Apple platforms.
- qaq 2y agoSwift is really cool but has really sharp edges for a primary lang for such a huge ecosystem
- feelingsonice 2y agoSwift needs to figure out what it wants to do and stick to it. Too many syntactic sugar and too many half baked concepts pushed through the door.
- CagliariX 2y ago+1
- cutler 2y agoI find this bid for cross-platform recognition somewhat schizoid given that Swift isn't even backwards compatible on Mac OS. I has to upgrade to Ventura a while back just to get Swift regexen working.
- plorkyeran 2y agoThis is somewhere that Swift is better on non-Apple platforms. You have to upgrade macOS to get Swift bug fixes because the runtime is part of the OS, while on other platforms it’s a separate thing that can be upgraded on its own.
- cutler 2y agoMaybe they should get their own house in order first.
- belfalas 2y agoI really love the Swift language. I think it is really nice to program in. When it is really good, it just is so satisfying. I can get that "ahh" feeling. I feel like it's this weird blend of Ruby, Haskell, Javascript, and some C# influence. And of course there is always Objective-C baggage lurking in the background. I agree with most of the comments on this thread. The governance of the language really is a problem. You really can't run two models on the same project at once. The incentives just always get screwed up. Better to just be honest about what's going on, and then everybody can work together. But sometimes that means that people need to start getting paid, and companies love to not pay money if they can avoid it. Also, Apple's tooling is just truly horrendous. It is just awful. I don't understand why they won't do anything about it. Xcode, there are some things that are nice about it, but compare it to really using a tool like IntelliJ IDEA well and Xcode just fails so hard. And certain UX problems have literally persisted for a decade, and Apple has not done anything about it. It really is kind of unconscionable that Apple does this to their developers. I know on some level I am being ungrateful, because there are mountains being moved behind the scenes by Xcode, and I really do appreciate that. And from watching WWDC talks, I know that there are some really good engineers at Apple that are trying to do the right thing. And some of it is just corporate BS that is unavoidable. But they really do need to get better. In any case, I hope that this update makes everybody's life better. When it is really nice, I think that Swift has some of the best developer ergonomics out there. That's just one person's opinion, of course.
- damnever 2y agoSwift still lacks some concurrency features, even with Swift 6, but it's nice to see that atomic operations have finally been added. Besides that, I often encounter an error without knowing why: 'Failed to produce diagnostic for expression; please submit a bug report.'
- sirwhinesalot 2y agoCTRL-F "no longer takes 37000 years to typecheck a simple expression". "0 matches". Maybe on the next one.
- CagliariX 2y agoSwift is over-engineered and they don't care about compatibility between versions and just add things even if we can live without new features. It will become huge hard to use and properly understand language and will die. Flutter, KMP and maybe even ReactNative will become much simpler and better choices and native on iOS will slowly but surely lose developers in my opinion.