我在Swift中重写了我的Objective C应用程序,我有一个关于枚举的问题.在Objective C中你会做;
typedef enum {
stopped,
running
} TimerState;
Run Code Online (Sandbox Code Playgroud)
返回错误,Consecutive Declarations on a line must be separated by ‘;’ — Expected declaration — Expected identifier in enum declaration.我阅读了一些关于此的文档,发现你不再typedef在enum之前放了.因此,我认为它会是:
enum {
stopped,
running
} TimerState;
Run Code Online (Sandbox Code Playgroud)
但我不知道如何处理TimerState,这是否在花括号中?我该怎么办.请不要自作聪明评论.提前致谢.