You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two web fetches that update the same object at different times.
Hotel <- HotelJSON
Hotel <- HotelPriceJSON
Both JSONs use HotelId as the unique key. Is it possible to make those both unique objects? Prrotocol can only be declared on Hotel once. Is there a workaround?
The text was updated successfully, but these errors were encountered:
try transaction.importUniqueObjects(Into<Hotel>(),
sourceArray: jsonArray.map({.hotelJSON($0)}) // or .hotelPriceJSON depending on the method
)
Then in your ImportableUniqueObject implementation:
publicfunc update(
from source:ImportSource,
in transaction:BaseDataTransaction)throws{
switch source {case.hotelJSON(let json):
// parse as how you expect
case .hotelPriceJSON(let json):
// parse as how you expect
}}
I have two web fetches that update the same object at different times.
Hotel <- HotelJSON
Hotel <- HotelPriceJSON
Both JSONs use HotelId as the unique key. Is it possible to make those both unique objects? Prrotocol can only be declared on Hotel once. Is there a workaround?
The text was updated successfully, but these errors were encountered: