SwiftUI CoreData relationship binding Bug

86 Views Asked by At

I developing simple app to calculate personal money income and consumption.

I use CORE DATA to save my model.

The models consists of this

CDCatalogWallet
var name: String
var ref: String

CDCatalogStateIncome
var name: String
var ref: String

CDDocumentIncome
var ref: String
var wallet: CDCatalogWallet (relationship has one)
var states_: CDDocumentIncomeState (relationship has many)

CDDocumentIncomeState
var cdCatalogStateIncome: CDCatalogStateIncome (relationship has one)
var document: CDDocumentIncome (relationship has one)

CDDocumentIncome hasMany -> CDDocumentIncomeState hasOne -> CDCatalogStateIncome The bug shows when we pushing CDDocumentIncomeState view

The model is simple. The CDDocumentIncome has relationship property cdCatalogStateIncome (relationship many).

We open view with CDDocumentIncome and want to add new cdCatalogStateIncome to CDDocumentIncome

Then we open view with new cdCatalogStateIncome. On this screen cdCatalogStateIncome has a relationship to CDDocumentIncomeState.

But view does not opened. Console constantly print messages

DocumentIncomeStateDetailView: @self changed.
DocumentIncomeStateDetailView: @self changed.
DocumentIncomeStateDetailView: @self changed.
DocumentIncomeStateDetailView: @self changed.

Also memory increase constantly and very fast.

enter image description here

I understand that the view renders constantly. But I cannot figure out what cause a bug.

The full code is available on github

Github Project

1

There are 1 best solutions below

0
Grigory On BEST ANSWER

The problem was in Old Xcode. After update Xcode to version 15.2 all issues disappeared.