@Binding and ForEach in SwiftUI

⛔️ Don’t use a Bad practice!

Most of the answers (including the @kontiki accepted answer) method cause the engine to rerender the entire UI on each change and Apple mentioned this as a bad practice at wwdc2021 (around time 7:40)


✅ Swift 5.5

From this version of swift, you can use binding array elements directly by passing in the bindable item like:

enter image description here

⚠️ Note that Swift 5.5 is not supported on iOS 14 and below but at least check for the os version and don’t continue the bad practice!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)