-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix json model problems so that you can access objects correctly #329
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
|
||
if let experiments = optimizelyClient?.optimizely?.config?.experiments { | ||
for experiment in experiments { | ||
print(experiment.experimentKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Print? Is this desired?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's the demo app. this is just proving that the change works.
* fix json model problems so that you can access objects correctly * use the project config to correctly get experiments
The PR fixes the issue with Swift 4.2 accessing the entities in a data model and having to cast them because the protocol is not actually defined.
The problem is that these were not implemented correctly to start with. The entities should be what an array should contain. The protocols are just notations for JSONModel (OPTLYJSONModel). So, for example:
The above old implementation defines a array of OPTLYExperiment protocol objects. However, the OPTLYExperiment contains no methods or properties. The proper declaring is the following:
This seems to be a JSONModel specific annotation via the protocols at the end.
**We should do this for all data model objects using arrays of protocols.