Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-1111

Xcode12Beta: Value of type 'CBLArray' has no subscripts

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Major
    • 2.8.0
    • 2.8.0
    • iOS
    • Security Level: Public
    • None
    • 3

    Description

      CBLArray, CBLMutableArray, CBLDictionary, etc are failing on Xcode 12

      Protocols and class defined in ObjC

      @protocol Model <NSObject>
      - (NSInteger) objectAtIndexedSubscript: (NSUInteger)index;
      - (void) functionality;
      @end
       
      @interface ModelObject : NSObject <Model>
      // This will avoid the error::
      // - (NSInteger) objectAtIndexedSubscript: (NSUInteger)index
      @end
       
      @implementation ModelObject
      - (NSInteger) objectAtIndexedSubscript: (NSUInteger)index {
          return 0;
      }
       
      - (void) functionality {
          NSLog(@"called functionality");
      }
      @end
      

      Calling from Swift

      class SwiftModel {
          func someFunction(obj: ModelObject) {
              // works fine
              obj.functionality()
              
              // error: Value of type 'ModelObject' has no subscripts
              print(obj[0])
          }
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              pasin Pasin Suriyentrakorn
              Jayahari.Vavachan Jay Vavachan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty