We have an iOS project. The Swift language version is 4.2. We were previously building it in Xcode 10.1 with no compile errors.
After updating to Xcode 10.2 (but keeping Swift 4.2), the project is now riddled with errors like Invalid redeclaration of 'variable.storage'
(where variable
is the name of some variable). These errors appear next to private, lazily-inited variables with names that are commonly used throughout the project, but are not redeclarations within their scope; the error seems to relate to the storage
part of the message. A clean-and-rebuild did not resolve the issue. Any suggestions?
EDIT: These errors only showed up in two classes. There was also another legitimate compile error (new in Xcode 10.2, but legitimate enough) that I missed because of all these redeclaration errors. After messing around a bit**, I got the errors to go away. Seems like a bug in the compiler.
** My messing-around steps were (1) un-nest the first class I was getting these errors in, (2) created a new class with the same content as the non-compiling one and pointed references to it, (3) commented out the failing class, (4) found and fixed the legitimate compile error. At this point, I didn't need to mess around with the other class that was also giving the redeclaration errors; the code now compiled. So then (5) reverted the first class. So it's possible that these redeclaration errors are just a misdirect; if you find and fix all your migration-related errors, hopefully you won't see any of these.