4 ms·
I've found that Xcode's performance with autocomplete, highlighting, etc with Swift depends on how you write Swift. Here's how I generally keep Xcode/SourceKit
by kitsunesoba 6y ago
I've found that Xcode's performance with autocomplete, highlighting, etc with Swift depends on how you write Swift. Here's how I generally keep Xcode/SourceKit happy:
- Limit interaction between Swift and Obj-C wherever practically possible. Swift headers for Obj-C functions are autogenerated by the compiler, which can act as a bottleneck depending on how much Obj-C is in your project, how often that Obj-C changes, and how often you clean the project.
- Avoid nesting closures deeper than 2 levels (probably good advice anyway).
- Explicitly state types where possible to avoid inference.
- Avoid excessively long chains of optionals and/or casts.
So generally, try to keep code clean and explicit, and when choosing dependencies opt for pure Swift options where viable. Avoid adding new Obj-C code except where needed (e.g. C++ interop) and if possible reduce Obj-C in the project to small, seldom changing bits.