Re:30k lines of SwiftUI in production later
by kitsunesoba on Saturday January 28, 2023 @10:01AM
(#34558042)
I spend most of my day in Xcode and for a while the main frustration was SourceKit being slow/crashy. That’s improved a fair deal over years, but I’ve found that the best thing one can do to improve that, as strange as it sounds, is to avoid code smells.
SourceKit can get really grumpy with things like deeply chained optionals, deeply nested blocks, and lots of casting or otherwise fighting against the type system. Not doing those things makes it run significantly more smoothly. So if Xcode starts bogging down or SourceKit is crashing, it means there are probably cleaner ways to write whatever I’m currently working on.
SourceKit can get really grumpy with things like deeply chained optionals, deeply nested blocks, and lots of casting or otherwise fighting against the type system. Not doing those things makes it run significantly more smoothly. So if Xcode starts bogging down or SourceKit is crashing, it means there are probably cleaner ways to write whatever I’m currently working on.