2

I'm working with Swift using Xcode 6.4.

Whenever enter/return key is pressed (also occurs on press of tab key) the code below gets duplicated.

I've tried by deleting duplicated code, adjusting space/tabs but none worked.

Why is this happening? What's the fix?

Screenshot 1 is when I first time encountered this problem. Screenshot 2 is error occurred the next day.

Screenshot 1 for error

Screenshot 2 for error

Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
  • 1
    I upvoted, I don't know why someone down voted before as it's a genuine good question and a nasty problem. Sorry can't help very much but have you tried this in another file, other project ? Re-installed Xcode ? – Glenn Oct 09 '15 at 08:38
  • @Glenn : I've tried on different line of code. It happens at times. When I quit Xcode and start working on same code next day it works fine. – Jayprakash Dubey Oct 09 '15 at 10:12
  • and in another project ? – Glenn Oct 09 '15 at 10:21
  • @Glenn : I've found work-around for this one. You can check answer posted. – Jayprakash Dubey Oct 09 '15 at 10:38

1 Answers1

0

I've found work-around for this issue. You have to press enter/return on place where one line below are empty. For above issue go to end of handler statement and hit enter\return key.

In the above case (question posted) duplication of code occurs when return\enter key is pressed while cursor is positioned above any line of code.

This may be Xcode issue for Swift and might be fixed in Xcode 7 (not tried yet).

Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177