While Apple has been big on pushing multi-platform Swift right now and distancing itself a bit from the Swift branding in some ways (e.g. it having its own GitHub organization) they've historically had quite an ebb and flow to this behavior. If their priorities changed, what happens to the non-Apple projects that adopted Swift? It would be better if there were multiple parties that had stake and some control in the future of Swift.
I have similar worries with Microsoft and .NET, although it's a bit different owing to the fact that Microsoft is quite a different company with different problems.
It's actually kind of bizarre that it never really felt like Google was a problem for Go, but I guess that's because unlike Apple Swift and Microsoft .NET, Go mostly targets and is almost entirely developed on platforms that Google has little control over. (Though that doesn't mean that their presence is entirely unnoticed, but even stuff like the module proxy has been more well-received than expected. It's an odd area where Google has managed to maintain some goodwill, though it could evaporate over night.)
[0]: https://www.swift.org/getting-started/embedded-swift/The IDE story is a bit complicated though, either you go for Rider, or have to delve into the internal politics of VSCode vs VS, and features that VSCode will never get because there are those VS licenses to sell.
Having now spent time in all three, swift feels the most ergonomic and has features that make me feel productive. I still feel like there isn’t much “there” in Go, and rust makes me feel like I’m solving for the compiler rather than working on whatever problem I was needing to work on.
Edit to add: SwiftUI, however, is a mess that I loathe. I may be in the minority of enjoying the IoC choices in Interface Builder and AppKit.
It makes print-statement debugging look cutting edge.
The biggest (and known) issue with SwiftUI is the complex error messages you get, and the fact that the type checker will give up and ask you to break up your view into "distinct sub-expressions." Really the issue is almost never the complexity of a view, but some simple syntax error (passing the wrong type to a function, etc).
Isn't this literally what the person above is talking about?
> Really the issue is almost never the complexity of a view, but some simple syntax error (passing the wrong type to a function, etc).
The issue is that this is a big, known, common problem that cannot be solved, apparently
Why this is not a top priority before literally anything else?
Perhaps it was a pure academic reply? Because reality always trumps theory.
Yes, exactly.
I am wondering if you have a common example that would timeout or have problems.
If not then I struggle to see what similarity you are seeing.
(Genuine question, I am interested in what other languages do)
After the recent minor XCode upgrade, Swift can't deduce the type for an expression `((v2 * scalar1) * v3)`, I have to split `let tmp1=v2*scalar1` for it to work.
Like, wtf, Apple?
It doesn't even have to be deep. I ran into this issue on very few quite simple components. The compiler just gives up because somehow swift's type system makes it impossible to figure out
As an added bonus, this is also the way to get good performance at run time. It helps minimize how many views need to get re-evaluated when something changes.
And so I write pure code UIKit most of the time. It’s not trendy but it’s very effective.
For me, SwiftUI does exactly two things better than UIKit: tables and collection views. For everything else, it's so much easier to get stuff done with UIKit*, regardless of if I'm working with Interface Builder or making UI in code (as per various projects I've dropped into).
In theory, reactive UI is good. In practice, at least in the case of SwiftUI, the "magic" data passing does sometimes fail — perhaps someone put in the wrong @ on the property — and then you've got to debug some weird magic, and if there's a sensible place to put a breakpoint for that kind of problem I have yet to learn it.
In theory, the UI is reusable across all Apple platforms. In practice, the nature of the user experience is so different that actually trying this makes it suck for everyone — you don't want finger-sized buttons on a mouse-driven UI or tiny mouse-suitable click areas for a mobile UI, and I have no idea what the user expectations are for tvOS or WatchOS despite having written apps for both because hardly anyone shares their experiences and lessons learned.
In theory, having the code be the source of truth for the WYSIWYG editor is great. In practice, the WYSIWYG editor keeps giving up because of e.g. a compiler error, and decides to stop forever until you manually resume the preview.
* I'm mostly on iOS rather than macOS, but I'd assume UIKit and AppKit have the same strengths and weaknesses.
This is the practice (when people are lazy). The theory that Apple presented was that you are supposed to tweak your UI for each platform and share some of the common code.
How would UIs work on other platforms, though?
I think for right now, you'd have to use the C interop and link against something like GTK or other GUI library. I don't think SwiftUI specifically would ever work well cross-platform, it has so many Apple-isms.
There's also Swift/Win32, but it's MVC. You could also use the interop and use QT as well.
I don't think any of those are necessarily good solutions, but they are there.
Thank you though.
There’s stuff like SwiftCrossUI that does multiple backend bindings
https://github.com/stackotter/swift-cross-ui
And Qt was exploring some bindings using the new C++ interoperability.
https://github.com/ShaftUI/Shaft
Like Flutter, this paints everything itself. It doesn’t need to bind to a UI framework directly. Instead, it needs the platform to provide primitives like a surface to draw into and input events.
Sure, if you are on Apple devices. If you are not, better to use other languages like Rust, Go, or even Dart.
It was pretty dead for a few years (despite what the googlers will tell you...)
Relevant to the topic, Dart (and Flutter) supports targeting wasm.
#!/usr/bin/env swift
I made this small "shebang thing runner script" that either runs your script interpreted, or compiles and executes it. Depending on if you're on a TTY or not. I'm also changing it to simply check for the number of executions since last modified, and then compile. In some cases the extra time is well appreciated. You still get the convenience of interpreting, but also the performance of native.It's basically a drop-in replacement:
#/path/to/autocompile_or_interpret_swift
Very noticeable difference. real 0m0.212s user 0m0.159s sys 0m0.045s
vs
real 0m0.014s user 0m0.004s sys 0m0.008s [0]: https://github.com/apple/swift-argument-parserIt's kind of nice to be able to access all native libraries. I usually use ruby, but having something compiled and strict is super nice. Shellscripting it one big minefield.
Compiling is a simple step ofc. But it's nice to only have the scriptfile and it's nice to not have your directory cluttered with binaries. I'll see if I can post it tomorrow. It's very small anyway