1

How can we comment multiple lines in Xcode 9. I know about Command + /

But This inserts // in front of every selected line.

But I want it like /*......*/

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Krishna Meena
  • 5,693
  • 5
  • 32
  • 44

1 Answers1

0

Xcode does not provide that type of comment (/* .. */) in shorthand in any version so nothg different in x-code 9 regarding this,

check this -> https://forums.developer.apple.com/thread/49473

So for code commenting do anyone of follow

  1. cmd+/ is used for // the multiple lines,
  2. For /* ... */ either you have to manually
  3. can create code snipplet. No other option is available.

Code Snipplet

enter image description here

dahiya_boy
  • 9,298
  • 1
  • 30
  • 51
  • it is used for `//` for single line comment or group comment – Anbu.Karthik Sep 28 '17 at 08:46
  • @Anbu.Karthik Select number of lines and then press `cmd + /`, then selected lines are commented. Thats what I mean. – dahiya_boy Sep 28 '17 at 08:47
  • I thought there would be a option as Xcode while creating viewcontroller creates this one /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } */ – Krishna Meena Sep 28 '17 at 08:58
  • @KrishnaMeena Unfortunately question is not related to segue :/ – dahiya_boy Sep 28 '17 at 09:04
  • Yes question is not related to segue but what I mean is xcode creates sample code for segue and by default commenting it also like /*......*/ – Krishna Meena Sep 28 '17 at 09:09