Thanks for your feedback. Here is my code:
MainView
var body: some View {
if (notificationRB == true || DEBUG) {
TabView {
RingBellMainView(requests: [], delegate: delegate, isOffline: true, isConfigured: false, ringBellStatus: .not_configured, pushNotificationStatus: .not_configured, isLoading: false)
LocalScenariosTableView(scenarios: [], delegate: delegate, isLoading: false)
GlobalScenariosTableView(scenarios: [], delegate: delegate, isLoading: false)
SettingsView(isSilentModeEnabled: delegate.isSilentModeEnabled, delegate: delegate)
}
//.tabViewStyle(.verticalPage(transitionStyle: .blur))
.tabViewStyle(.page(indexDisplayMode: .always))
.onAppear(perform: {
delegate.ringBellService.register(model: self.model)
model.setup(mainView: self)
})
}
}
LocalScenariosTableView
var body: some View {
NavigationView {
if (scenarios.isEmpty) {
LocalScenariosEmptyState()
.onAppear(perform: {
delegate.scenarioService.register(model: self.model)
model.setup(tableView: self)
delegate.scenarioService.refresh(global: false, complete: {
scenarios in
})
})
.onReceive(timer, perform: { _ in
if (!isLoading) {
self.delegate.scenarioService.refresh(global: false, complete: {
scenarios in
})
}
})
} else {
List {
ForEach(scenarios) { scenario in
ScenariosTableViewCell(scenario: scenario, delegate: self.delegate, showProgressView: Binding.constant(false), isLoading: Binding.constant(false))
}
.listRowPlatterColor(.black.opacity(0.6))
.listRowInsets(.init(top: 4, leading: 8, bottom: 4, trailing: 0))
.clipShape(RoundedRectangle(cornerRadius: 10, style: .continuous))
}
.background(Image("bg")
.resizable()
.ignoresSafeArea()
.scaledToFill())
.scrollContentBackground(.hidden)
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Text("aw_local_scenarios".localized)
.font(.headline)
}
}
.onAppear(perform: {
delegate.scenarioService.register(model: self.model)
model.setup(tableView: self)
delegate.scenarioService.refresh(global: false, complete: {
scenarios in
})
})
.onReceive(timer, perform: { _ in
if (!isLoading) {
self.delegate.scenarioService.refresh(global: false, complete: {
scenarios in
})
}
})
}
}
}
Thanks!