Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find type 'ListBase' in scope #267

Open
wawilliams003 opened this issue Oct 30, 2022 · 1 comment
Open

Cannot find type 'ListBase' in scope #267

wawilliams003 opened this issue Oct 30, 2022 · 1 comment

Comments

@wawilliams003
Copy link

Hello, I am getting this error after updating to the latest version of ICream. I am using Cocoapods on Xcode 14.0, with swift 5.
RealmSwift (10.8.1)
IceCream (2.0.2)

public var record: CKRecord {
       let r = CKRecord(recordType: Self.recordType, recordID: recordID)
       let properties = objectSchema.properties
       for prop in properties {
           
           let item = self[prop.name]
           
           if prop.isArray {
               switch prop.type {
               case .int:
                   guard let list = item as? List<Int>, !list.isEmpty else { break }
                   let array = Array(list)
                   r[prop.name] = array as CKRecordValue
               case .string:
                   guard let list = item as? List<String>, !list.isEmpty else { break }
                   let array = Array(list)
                   r[prop.name] = array as CKRecordValue
               case .bool:
                   guard let list = item as? List<Bool>, !list.isEmpty else { break }
                   let array = Array(list)
                   r[prop.name] = array as CKRecordValue
               case .float:
                   guard let list = item as? List<Float>, !list.isEmpty else { break }
                   let array = Array(list)
                   r[prop.name] = array as CKRecordValue
               case .double:
                   guard let list = item as? List<Double>, !list.isEmpty else { break }
                   let array = Array(list)
                   r[prop.name] = array as CKRecordValue
               case .data:
                   guard let list = item as? List<Data>, !list.isEmpty else { break }
                   let array = Array(list)
                   r[prop.name] = array as CKRecordValue
               case .date:
                   guard let list = item as? List<Date>, !list.isEmpty else { break }
                   let array = Array(list)
                   r[prop.name] = array as CKRecordValue
               case .object:
                   /// We may get List<Cat> here
                   /// The item cannot be casted as List<Object>
                   /// It can be casted at a low-level type `ListBase`
                   -------ERROR ON THIS LINE BELOW----------
                   **guard let list = item as? ListBase, list.count > 0 else { break }**
                   var referenceArray = [CKRecord.Reference]()
                   let wrappedArray = list._rlmArray
                   for index in 0..<wrappedArray.count {
                   ---- AlSO THIS ERROR ON LINE BELOW : -- Type of expression is ambiguous without more context -- 
                       guard let object = wrappedArray[index] as? Object, let primaryKey =     object.objectSchema.primaryKeyProperty?.name else { continue }
@andresitsu
Copy link

You may use the most updated version of Realm by switching to Leon's forked IceCream (see Pull Request), which solved this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants