You can use the platform's dynamic configuration for application settings that are loaded at runtime. You can also subscribe to changes in these settings. These may include styling options, metadata or feature toggling. Within Studio, these settings are found in the Project > Setup > Experience tab and are specified in your App Spec.
In order to use this capability, you will need to load the Project and obtain data from its fields as follows:
funcloadProject() {// Interact will already be initialised at this stage Interact.defaultCore.getProject(completion: { [weak self] result inguardlet self = self else { return } do { self.display(project:try result.get()) } catch {// Treat the error } })}funcdisplay(project: Project) {// You can use project fields in your UI by fetching them like so:let id = project.idlet myField = project.fields["my_field"]}
funloadProject() { Core.default!!.interact.getProject { it.onSuccess {display(project = it) } it.onFailure {// Treat the error, `it` is a throwable } }}fundisplay(project: Project) {// You can use project fields in your UI by fetching them like so:val id = project.idval myField = project.fields["my_field"]}
You can be notified of any update on the project by using this snippet:
// Called whe the project fields are updatedconstunsubscribeOnProjectFieldsUpdated=onProjectFieldsUpdated( project, () => { console.log(project) });// Called when the project listings are updatedconstunsubscribeOnProjectListingsUpdated=onProjectListingsUpdated( project, () => { console.log(project) });// Called when an event is publishedconstunsubscribeOnEventPublished=onEventPublished( project, (event) => { console.log(event) });