I've noticed that the iOS 15 simulator's Spotlight process hovers around 100% of (the Mac's) CPU pretty consistently. Since SwiftUI previews spin and keep simulator instances around aplenty, this pretty quickly adds up to an unusable development setup.
Somehow this only got my attention after working against iOS 15 simulators for close to two weeks, so I am wondering if it might be a corruption known to occur, similar to what happens to Spotlight on the Mac occasionally and requires a forced re-index. That said, spinning up a blank slate simulator doesn't seem to fix the issue, which points more to a bug in the beta. Any ideas for steps to try?
Filed as FB9196320
As I haven't found a way to edit my first answer above: I have found a solution to fix the SwiftUI Preview simulators
- Find all
com.apple.suggestions.plist
files in~/Library/Developer/Xcode/UserData/Previews/Simulator Devices/
- Set the key
SuggestionsAppLibraryEnabled
toNO
The following script does the job nicely:
cd ~/Library/Developer/Xcode/UserData/Previews/Simulator\ Devices/
find . -name com.apple.suggestions.plist -exec plutil -replace SuggestionsAppLibraryEnabled -bool NO {} ";"
This approach also works for regular Simulator instances.
Instead of opening "Settings" and disabling "Suggestions on Home Screen", you can use below script to do the job:
cd ~/Library/Developer/CoreSimulator/Devices
find . -name com.apple.suggestions.plist -exec plutil -replace SuggestionsAppLibraryEnabled -bool NO {} ";"