Search code examples
swiftreact-nativecouchbase-liteios15xcode13

XCode 13 SortOrder is ambiguous


Check out this error in the most recently updated Xcode (13):

enter image description here

Did Apple screw something up? How do I fix this? I can see when I start typing SortOrder it shows a Protocol and an Enum.


Solution

  • Because of the conflicting SortOrder enum and protocol, it's ambiguous to the compiler which one you want to use.

    Because the SortOrder enum is part of the Foundation framework, you can do the following to explicitly use it:

    Foundation.SortOrder
    

    Example usage:

    Foundation.SortOrder.forward
    

    Or in your case, you needed SortOrder from CouchbaseLiteSwift:

    CouchbaseLiteSwift.SortOrder