I can't believe I just now learned this in Xcode

You can select some text, cut it with ⌘X, select a folder in the navigator and paste with ⌘V, and it puts it in a new file

And all this time I've kept all my code in one giant file

@simsaens saw this mentioned in Xcode Essentials https://developer.apple.com/wwdc24/10181 and was blown away as well 😀
Xcode essentials - WWDC24 - Videos - Apple Developer

Edit, debug, commit, repeat. Explore the suite of tools in Xcode that help you iterate quickly when developing apps. Discover tips and...

Apple Developer