2

Overnight, my Xcode got updated to 13.3. Since then, I am getting an error while compiling.

I have a method, which is now called xxxxasdfxxxx(). It appears in the last line of an if statement. For example:

       if  let state = ...,
            let field = state....,
            !field.xxxxasdfxxxx()
        {
        }

Whenever I compile, the code magically changes from a method to a property. So the above code suddenly looks like:

        if  let state = ...,
            let field = state....,
            !field.xxxxasdfxxxx {

Note, it is even moving the opening brace as well. I do not know if that is relevant.

This is a breaking change and I have no idea why it is doing it. Obviously the name of the function is not important as I have changed it several times. Interestingly, I have a piece of identical code in another part of the project that is not being magically changed.

Does anyone have an idea as to why this might be happening and how to get around it?

Erik Allen
  • 1,841
  • 2
  • 20
  • 36
  • I did a workaround that did work but I'm not proud of it: I changed the function to a property. The function was simple enough, and it wasn't used too much, so this was an option for me. – Erik Allen Mar 16 '22 at 15:42

3 Answers3

3

I had the same problem with Xcode 13.3 and I don't know what is causing that. But I found a solution that worked for me and made possible to build the application without further problems.

Just remove the ! from de method's call and use == false instead as follows:

            if  let state = ...,
            let field = state....,
            field.xxxxasdfxxxx == false {
3

This appeared to be happening to me as well. Setting the values == false did seem to work, but we had too many instances to change. After looking into it, it seemed perhaps it was our SwiftLint instance. Sure enough, updating SwiftLint to the latest release (0.47.0) fixed the issue. I'd recommend Double check your linters if you have any installed.

0

I had the same problem with Xcode 13.4 and I solved it updating SwiftLint using this command line: brew upgrade swiftlint

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 27 '22 at 14:10