I am an Android Developer and recently started learning Swift. There is a cool feature in Android studio called Instant Run, that significantly reduce the build and deploy times for incremental code changes during coding.
Introduced in Android Studio 2.0, Instant Run is a behavior for the Run and Debug commands that significantly reduces the time between updates to your app. Although your first build may take longer to complete, Instant Run pushes subsequent updates to your app without building a new APK, so changes are visible much more quickly.
If you enable Instant Run on Android Studio, There is no need to build and run the app from scratch, specially when you are working on some detail View Controller in the middle of the app (storyboard).
I am curious to know if this feature or sth similar is available in XCode or I must run the app from scratch every time I want to test the app?
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!).
To build and run your code, choose Product > Run, or click the Run button in your project's toolbar. Xcode analyzes your scheme's targets and builds them in the proper sequence. After a successful build, Xcode launches the associated app.
The basic way to open a list of simulators is to use Xcode -> Window -> Devices and Simulators. Here you can create and manage all available simulators.
if you used that SwiftUI use the next option when your device is connected!!!
and press: cmd + s
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With