0

I'm trying to work with MongoDB Realm to import data from a database, and then pass that data from the homescreen view (UIHomeScreen) to another view (PlantDeviceListView). I've setup the Models, binding variables, and passed the data before successfully, but after refactoring some code, I'm not sure why I'm getting errors on the following code in SceneDelegate.swift:

 let contentView = UIHomeScreen(sensors: sensordata)

error says: Cannot convert value of type 'sensordata.Type' to expected argument type 'sensordata'

sensordata is the Model of the object I am trying to import from realm, and it is a class Object.

In the UIHomeScreen itself, I have the variable set up as follows:

@ObservedObject var sensors: sensordata

Any idea what I might be doing wrong?

  • Does SensorData confirm to Observable? – davidev Jul 10 '20 at 15:41
  • I believe it does, as the class sensordata is setup as the following: class sensordata: Object, ObjectKeyIdentifable {...} – neddyflanders7 Jul 10 '20 at 15:50
  • This is just confirming to Identifiable, not to Observable – davidev Jul 10 '20 at 16:05
  • I see - unfortunately when I try to set the object as Observable instead of Identifable, it throws an undeclared object type error. How should I structure the class and the corresponding UIHomeScreen ObservableVar properly? – neddyflanders7 Jul 10 '20 at 16:13

0 Answers0