GM release of Xcode 6 compile

前端 未结 21 2446
难免孤独
难免孤独 2020-12-02 15:37

I just downloaded the GM release of Xcode 6 and it won\'t compile with this error:

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault         


        
21条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 16:14

    My case was a little bit different and it involves enums and optionals. For the simplicity lets define

    enum Animal {
        case Dog
        case Cat
    }
    
    func exampleAction(animal: Animal) {}
    
    exampleAction(.Cat)
    

    It will run OK. However as soon as I made the argument optional the error started to appear. So this code won't work:

    func exampleAction(animal: Animal?) {}
    
    exampleAction(.Cat)
    

    To make it work I had to add explicit enum name in the method call. So the following code worked again:

    exampleAction(Animal.Cat)
    

提交回复
热议问题