Instant Run or Hot Reloading for Xcode
if you used that SwiftUI use the next option when your device is connected!!!
and press: cmd + s
You can select the initial - viewController
for your project either from the storyboard or programmatically; to the view, which you only need to load at the time for testing.
But, You actually don't need to worry about compiling your code from scratch. This is kind of automate behavior for xCode, as it only compiles your code which you have changed.. You may notice this within your files hierarchy as shown below:-
The 'M' & 'A' at the side of files refers to; 'Modified files' & 'Added files'
The files without modification; after a build, won't take as much time to build.
THERE IS A WAY !
I've found this question a while ago, and conclude that there weren't any way to have a real instant run in iOS.
BUT ! I've recently found an awesome lib that allow you to bring to iOS this awesome feature. I share it here because it became essential for me and I would have loved to found it when I came here the first time. It's called Injection for Xcode and it take the form of a plugin. The installation is a little long because of new Xcode limitations. You will have to patch Xcode to be able to run plugins in it. You can find all these informations in the Read Me or in the "Issues". It can take up to 30 minutes, but this plugin is a real time saver !
Once it is installed, run your app as usual with Xcode (CMD + R
). Then, change code somewhere in a controller. Now, click CTRL + =
to use the Injection plugin. You won't see any reloading in your simulator, but if you try you will see that your code changes has been taken (in a few seconds!).
For example you have this line :
self.view.backgroundColor = [UIColor blackColor];
After your app is running with CMD + R
, change the line to :
self.view.backgroundColor = [UIColor whiteColor];
Press CTRL + =
, and enjoy !
Hope this helps somebody ! If you have any questions (for installation or other), please ask me in comment.