swift3 - Protocol Property Allowed With Realm? -


i'm trying model data.

i have class contains optional property of type excercisecontent.

import realmswift  class excercise: object {   var content: excercisecontent?  } 

the idea excercise contains content, duration, , 1 of two: audio or text.

protocol excercisecontent {   var duration: int { } }  protocol audioexcercisecontent: excercisecontent {   var audio: string { } }  protocol textexcercisecontent: excercisecontent {   var text: string { } } 

i found similar question, know if still applies, , response means "realm needs know concrete object type linked @ initialization time."

i've declared protocol, shouldn't realm know object type? or object type different every time, , that's why can't done?

realm needs know concrete object type linked @ initialization time..

your content property should either realm object or 1 of supported property types.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -