3 ms·
TLDR: 1) Don't watch too much state with Observable/EvironmentObject. When any watched property changes EVERYTHING RELOADS every time. 2) ScrollView.scrollTo
by DelightOne 4y ago
TLDR:
1) Don't watch too much state with Observable/EvironmentObject. When any watched property changes EVERYTHING RELOADS every time.
2) ScrollView.scrollTo is bugged with ForEach.
3) TextField and keyboard-interactions can be slow and buggy.
- jamil7 4y agoEvironmentObject is a total foot gun for performance and causes a bunch of other issues. Core Data and SwiftUI are also awkward together. We ended up keeping Core Data at arms length and building our own internal framework to do dependency injection.
- newZWhoDis 4y agoThe trick for 1) is to use @Observed object on a state class inside your app struct then push to views via @Published combine streams so you can map/filter/reduce. Storing massive state in every view/child view/grandchild view is both stupid and wasteful. 2 and 3 I can’t reproduce.
- DelightOne 4y agoYep! I currently use Composable Architecture for the same purpose.
- akmarinov 4y ago2 and 3 are fixed in iOS 15+
- ec109685 4y agoThis Equals behavior seems terribly unintuitive as well: https://swiftui-lab.com/equatableview/ https://swiftui-lab.com/equatableview/ When an object contains plain data, the equals interface is not used. That would so rough to debug the first time.