我认为有几个人遇到过这个问题,那就是枚举。
所以问题很简单,Xcode在枚举之后处理缩进很奇怪,起初我认为这是我的语法,但事实证明它可能没有(我不是在推测它(还)
所以这就是我的代码:
enum Signs : bool {
Positive = true,
Negative = false
};
<This is where Xcode suggest where my next line of code should be, which is one tab more then I expect.>
有人看过这个问题并解决了吗?
答案 0 :(得分:0)
通过为其中一个枚举成员指定值,可以100%复制此错误。
如果省略= someValue,
自动缩进将正确执行。这适用于包含任意数量枚举项的任何枚举。只要一个项目有[19:53:22] I/direct - Using ChromeDriver directly...
[19:53:22] I/launcher - Running 1 instances of WebDriver
[19:53:24 INFO(qe-reporter.js:71)] Executed 0 of 0 specs, SUCCESS: 0, FAILED: 0, PENDING: 0, SKIPPED: 0, Duration: 0 sec.
[19:53:24] E/launcher - unknown error: missing or invalid 'width' or 'height'
,结束括号就会不对齐。
它是2018年,XCode的开发人员仍然没有修复Xcode 9.2中的这个错误。因此,请提交错误报告(帮助菜单 - >报告问题),现在已经发现了每次复制它的方法。
答案 1 :(得分:-1)
我经常写这样的枚举:
//Using your example
typedef enum {
kPositive,
kNegative
}signs;
在那里你不会有缩进问题。但我无法回答为什么 Xcode的行为就像那样。