Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

459
Views
Errores de compilación de compilación en RxRealm.swift después de la actualización del pod de RxRealm: el tipo 'List<Element>' no se ajusta al protocolo 'NotificationEmitter'

Aquí está la parte superior del archivo RxRealm.swift. (En ningún otro lugar del archivo hay errores de compilación ni la función "observar".

 // // RxRealm extensions // // Copyright (c) 2016 RxSwiftCommunity. All rights reserved. // Check the LICENSE file for details // Created by Marin Todorov // import Foundation import RealmSwift import RxSwift public enum RxRealmError: Error { case objectDeleted case unknown } // MARK: Realm Collections type extensions /** `NotificationEmitter` is a protocol to allow for Realm's collections to be handled in a generic way. All collections already include a `addNotificationBlock(_:)` method - making them conform to `NotificationEmitter` just makes it easier to add Rx methods to them. The methods of essence in this protocol are `asObservable(...)`, which allow for observing for changes on Realm's collections. */ public protocol NotificationEmitter { associatedtype ElementType: RealmCollectionValue /** Returns a `NotificationToken`, which while retained enables change notifications for the current collection. - returns: `NotificationToken` - retain this value to keep notifications being emitted for the current collection. */ func observe(on queue: DispatchQueue?, _ block: @escaping (RealmCollectionChange<Self>) -> Void) -> NotificationToken func toArray() -> [ElementType] func toAnyCollection() -> AnyRealmCollection<ElementType> } extension List: NotificationEmitter { public func toAnyCollection() -> AnyRealmCollection<Element> { return AnyRealmCollection<Element>(self) } public typealias ElementType = Element public func toArray() -> [Element] { return Array(self) } } extension AnyRealmCollection: NotificationEmitter { public func toAnyCollection() -> AnyRealmCollection<Element> { return AnyRealmCollection<ElementType>(self) } public typealias ElementType = Element public func toArray() -> [Element] { return Array(self) } } extension Results: NotificationEmitter { public func toAnyCollection() -> AnyRealmCollection<Element> { return AnyRealmCollection<ElementType>(self) } public typealias ElementType = Element public func toArray() -> [Element] { return Array(self) } } extension LinkingObjects: NotificationEmitter { public func toAnyCollection() -> AnyRealmCollection<Element> { return AnyRealmCollection<ElementType>(self) } public typealias ElementType = Element public func toArray() -> [Element] { return Array(self) } }

Intenté agregar los apéndices de protocolo como se sugiere, pero no sé qué ocurre dentro de la función de observación agregada.

 public func observe(on queue: DispatchQueue?, _ block: @escaping (RealmCollectionChange<List<Element>>) -> Void) -> NotificationToken { // what goes here? }

Intenté dejar la función en blanco, pero arroja otro error: "Falta el retorno en una función que se espera que devuelva 'NotificationToken' (también conocido como 'RLMNotificationToken')"

Si pongo una función de retorno, no tengo idea de qué poner allí. Obv es el tipo NotificiationToken, pero ahora estoy perdido.

Esto está realmente por encima de mi cabeza, pero no hay nada al respecto en Cocoapods https://cocoapods.org/pods/RxRealm

Alguna idea de cómo solucionar este problema?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

trabajando para mi:

 pod 'Realm', '10.20.1' pod 'RealmSwift', '10.20.1' pod 'RxRealm', '4.0.3'
over 4 years ago · Santiago Trujillo Report

0

En Xcode 13.2.1, puede agregar este método, desde la extensión de sugerencia de xcode de Lista, Resultados...

 public func observe(on queue: DispatchQueue?, _ block: @escaping (RealmCollectionChange<List<Element>>) -> Void) -> NotificationToken { // what goes here? }

--->

 public func observe(on queue: DispatchQueue?, _ block: @escaping (RealmCollectionChange<Results<Element>>) -> Void) -> NotificationToken { return self.observe(keyPaths: nil, on: queue, block) }

Su problema se resolverá, pero si usa Cocoapods, debe editar directamente el archivo RXRealm en sus pods.

over 4 years ago · Santiago Trujillo Report

0

configuración de trabajo

 pod 'RxSwift', '~> 5' pod 'RxCocoa', '~> 5' pod 'RxAlamofire', '~> 5.1.0' pod 'RxRealm' pod 'RealmSwift', '10.20.1'
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!