Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

wirtandi

macrumors regular
Original poster
Feb 3, 2021
179
179
I am new to XCode and have several questions

1. How exactly do you duplicate a line? In VSCode, you can press alt + shift + up/down and it will duplicate that line. Or shift + option + up/down in mac
2. control + I only indents. I need an auto format feature, such as making sure there is whitespace before and after a "=". in VSCode, its shift + option + F.
3. WHen I am using the simulator, and I make changes, how do I update the simulator? Do I just press cmd + R again, at which point there will be a popup that says "there is already a new instance of the simulator, do you want to close it and open a new one?"
 

Kalzem

macrumors newbie
Dec 17, 2021
20
49
You go always go to Xcode > Preferences > Key Binding and assign whatever you want if you can find the feature.

1. With the new xcode 14, it's Cmd + D (select a line > Edit > Duplicate)
2. Ctrl + I is auto indent. You won't find any auto format. You can use vscode for that. Or you can use a linter like SwiftLint to tell you where the formating issues are.
3. There is no hot reloading on iOS. You indeed need to re-run the project which should automatically kill the previous simulator without the popup. Not sure why you have that.
If you really need hot reloading, there is a tutorial out there (https://www.merowing.info/hot-reloading-in-swift/) but it implies you build your code differently. I wouldn't recommend it, unless you 100% know what you are doing.
 

ADGrant

macrumors 68000
Mar 26, 2018
1,685
1,058
You go always go to Xcode > Preferences > Key Binding and assign whatever you want if you can find the feature.

1. With the new xcode 14, it's Cmd + D (select a line > Edit > Duplicate)
2. Ctrl + I is auto indent. You won't find any auto format. You can use vscode for that. Or you can use a linter like SwiftLint to tell you where the formating issues are.
3. There is no hot reloading on iOS. You indeed need to re-run the project which should automatically kill the previous simulator without the popup. Not sure why you have that.
If you really need hot reloading, there is a tutorial out there (https://www.merowing.info/hot-reloading-in-swift/) but it implies you build your code differently. I wouldn't recommend it, unless you 100% know what you are doing.
Code formatting is one area the Jetbrains IDEs really shine. You can tweak the formatting rules to format code exactly as you like it and unlike VSCode, AppCode can open, build, run and debug Xcode projects.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.