4 ms·
SwiftUI for Mac 2024
- simonbarker87 2y agoCode complete using the older APIs is a disappointing. As only a casual Swift dev, one of the hardest things to get a handle on is the myriad of ways there have been to do things in Swift and Apple frameworks over the years. The online community is amazing at writing articles and making up for Apple’s shoddy docs but I’ve got down a few paths recently that were “the old way”. I was really hoping their version of CoPilot would help with this but, unless this is just beta bugs, it looks like that’s not the case.
- msoad 2y agoThis is similar situation with Copilot. it does not suggest more modern web and JS APIs for me.
- viraptor 2y agoBetween lack of examples on SO and the API changing recently, copilot is simply left behind these days. We may get a better help for today's features in a year, when enough posts and projects use them.
- tomqueue 2y ago> Warning: there’s a bug right now that crashes the app in macOS 15.1. […] I’ve tested this with Xcode 16.0 beta 6 and Xcode 16.1 and they both act the same. But on a computer running macOS 15.0 beta 7 and Xcode 16.0 beta 6, it works perfectly. So this is a bug in macOS 15.1. One of the reasons I've left development for the Apple ecosystem is that these things happen all the time. They are tedious to fix and often require reverse engineering their system.
- snitty 2y ago>One of the reasons I've left development for the Apple ecosystem is that these things happen all the time. Bugs in beta software?
- iosguyryan 2y agoLeave the ecosystem. Microsoft and all Linux flavors have no bugs, including in all beta software.
- mdhb 2y agoThere is also something to be said for being a developer in an ecosystem that is actively hostile towards you and your interests as a software developer. It looks a lot like Stockholm syndrome from the outside at least. But I genuinely don’t understand how or why anyone would pick up native iOS / MacOS development in 2024. It seems like an incredibly shit medium to long term bet.
- greenthrow 2y agoiOS is a better place to make money than Android.
- viraptor 2y agoUntil you're not allowed to anyone. You get the higher risk and higher reward with them and just have to hope they're not looking at your app specifically today.
- jwells89 2y agoMy reason is that frameworks are generally more wide and deep than can be found elsewhere. It’s not difficult at all to build a polished app with nothing but Swift and AppKit/UIKit, with few or no third party libraries, which is increasingly rare in my experience (certainly not the case with WinUI or Android Framework). The next most comparable thing is Qt Widgets, but that’s for practical purposes restricted to either C++ or Python and is seemingly not receiving much attention any more than it’s been decided that the more “bring your own everything” style Qt Quick is the star of the Qt show. AppKit/UIKit aren’t afraid to be opinionated either which is occasionally annoying but 90% of the time a good thing, because that makes for tested and supported happy paths that work well. Android Framework is the biggest contrast here, being littered with multiple half-baked ways to do everything, none of which Google has shown any particular preference toward until in just the past few years. What would get me to move for my personal projects is something with that solidly “batteries included” aspect to it (there’s no excuse for needing to rope in a third party library to get something as mundane as a scrolling sortable table view with headers in a desktop UI framework, that’s like new cars coming without wheels) and similar opinionation, along with support for Swift or compiled Swift-like language.
- ChrisMarshallNY 2y agoWell, we'll see. I really like the fundamental ideas of SwiftUI, and want it to work, but have found that it doesn't allow me to write the kinds of apps that I like to release, so I still use UIKit/AppKit for my shipping apps. The documentation for SwiftUI (and most new Apple SDKs) is awful. It's clear that they are relying almost entirely on inline code docs. They used to have a legendary documentation team. Inline code docs can actually work quite well (I do it, myself[0]), but it requires serious discipline. If you cloc my codebases, it usually comes up 50/50 between docs and executable. [0] https://littlegreenviper.com/miscellany/leaving-a-legacy/ https://littlegreenviper.com/miscellany/leaving-a-legacy/
- lylejantzi3rd 2y ago> I still use UIKit/AppKit for my shipping apps. What's the best way to learn UIKit/AppKit in 2024?
- ChrisMarshallNY 2y agoI'm not sure, but I'll bet there's a ton of blogs and wisdom on it, these days. Most of the new stuff seems to use SwiftUI, but UIKit has been around since they first opened the SDK, and AppKit has been around longer than that. Apple likes to pretend everyone uses SwiftUI, but I'll lay odds that most AAA apps are ObjC-based.
- kranner 2y agoI liked Paul Hudson's Hacking with macOS (https://twostraws.gumroad.com/l/hwmacos https://twostraws.gumroad.com/l/hwmacos) which includes an older AppKit edition of the book. You'll have to account for changes in Xcode since the book was published. Also, there's a chapter that uses the now-defunct Dark Sky API but you can replace it with Pirate Weather's API which is 1:1 compatible.
- ChrisMarshallNY 2y agoPaul Hudson is excellent. He has a bunch of video tutorials and blogs, that I still find useful. He's good for SwiftUI, as well. I like his sense of humor, as well. To wit: https://m.youtube.com/watch?v=a905KIBw1hs https://m.youtube.com/watch?v=a905KIBw1hs
- cageface 2y agoI’m working on a moderately complex iOS and macOS app in SwiftUI. I haven’t tried the new stuff yet but it’s definitely a very mixed bag. It can save you a lot of time vs the old APIs for simpler things but it can make hard things even harder. And you’ll probably find yourself dropping down to UICollectionView and NSCollectionView for performance. Xcode remains a terrible IDE.
- ChrisMarshallNY 2y ago> It can save you a lot of time vs the old APIs for simpler things but it can make hard things even harder. Yup. I like to have a lot of fairly involved stuff, and SwiftUI falls down hard, when you stray from the beaten path. That's not unusual, but SwiftUI has no "in-between." You either do it 100% their way, or ... good luck with that. I really despise Auto Layout, but with IB and UIKit, I can do just about any type of UI I want.
- cageface 2y agoAutoLayout is a good example of the last generation of Apple APIs. Even the easy things are painful but if you need to do something really complex there's a way to make it work. Right now I'm stuck in a situation where any SwiftUI widget except for List has terrible performance but List imposes all these other constraints I can't live with so it looks like once again it's back to UI/NSCollectionView for me.
- lawgimenez 2y agoAs someone who works with both Android Studio and Xcode, I could say AS is lightyears ahead of Xcode. Gemini on AS is so good and most of the time accurate and adopts to how you name your variables and functions. Xcode 16 on the other hand, what a shitshow.
- jurip 2y agoI work in both too and will take Xcode any day of the week over AS. It has plenty of downsides but it's fast and surfaces errors well. YMMV.
- tartuffe78 2y agoAgreed, every time I open AS to update my company's Android apps (infrequently) I have to spend an hour Googling odd Java memory errors and grade sync complaints before I can do the minor tweaks I need to do to the actual app.
- lawgimenez 2y agoSounds to me that your Android codebase is a Frankenstein of a codebase.
- jwells89 2y agoAlso prefer Xcode. As long as you stay away from XIBs and Storyboards it’s more responsive than Android Studio. And yeah, if you let a project lapse on gradle and library updates for any length of time at all be prepared for a fight to get it all brought back up to speed. Swift Package Manager is generally less of a headache. Some of AS’ “smart” features are also more of a hindrance than a help at times, and don’t even get me started on ProGuard (which has no Apple ecosystem equivalent).
- iosguyryan 2y agoAlso. That said, autocomplete outside of Xcode is way more accurate. The latest beta predictive code is even worse than what we had… hallucinates APIs for the most vanilla of Foundation calls. Half my reflexive autocompletes now turn into — wtf I accepted this junk AI idea?
- happytoexplain 2y agoSwift UI makes simple UIs easier, moderately complex UIs harder, and very complex UIs impossible. The moment your UI is more complex than a stack of stacks, the elegance and comprehensibility falls apart compared to autolayout. It starts to feel like CSS all over again, using trial and error to try out combinations of elements and properties with unclear interactions. The pattern it enforces is theoretically great, but you will get much more mileage out of learning to write in a "reactive" style manually (When state changes, update view to match. It doesn't need to literally be a function of state to make it a function of state. E.g. don't leave ifs without elses.) A perfect combination would be a SwiftUI-style UI editor (sans bugs) to define UI, constraints included, but traditional layout management at runtime. Well, that or a ground-up redesign of SwiftUI's API.
- robin_reala 2y agoHow is CSS like trial and error?
- happytoexplain 2y agoBecause, compared to some modern layout systems, it takes longer (to put it lightly) to internalize the exact logic behind the implementation of all CSS properties and be able to simulate how they interact in complex UIs in your head.
- mitemte 2y agoCan you provide some examples of modern layout systems? I’d be curious to see what’s on offer. I have experience with various iterations of UIKit’s auto layout, Yoga, as well as CSS and some Swift UI. I’ve found CSS to be considerably easier to work with, particularly when using flexbox and grid.
- meindnoch 2y agoOk, then please implement the following in CSS: Outer +---------------------------------+ | | | Left Middle Right | | | +---------------------------------+ Everything should be vertically centered. Left should stick to the "left" of the outer div, "middle" should be centered, "right" should stick to the right. Left/middle/right can have different widths and heights. In AutoLayout this is achieved by 6 constraints: - left.left = outer.left - left.centerY = outer.centerY - middle.centerX = outer.centerX - middle.centerY = outer.centerY - right.right = outer.right - right.centerY = outer.centerY I'd like to see how you implement it in CSS. (note: extra wrapper divs are not allowed)
- deleted 2y ago[deleted]
- BaculumMeumEst 2y agoThe moment I start doing any development in the Apple ecosystem, I immediately perceive complete and utter contempt from Apple - coming from the extreme constraints placed upon me as a developer, from the requirement of using sadistic tooling, and from the lack of documentation and absence of engagement with the community in their forums. I get the distinct impression that Apple will begrudgingly allow me to develop and market a commercial tool, provided I pay them for the privilege, and that they very much hope that someday they will be able to rid themselves of third party developers once and for all.