News for hackers. Stuff that matters.
Re:Writing Gnome Apps with Swift by cageface on Wednesday March 27, 2024 @08:24PM (#39846338)
I really like the struct-based method of modeling data in Swift. The language makes this very convenient. Unfortunately the new Observation framework which is at the center of SwiftUI requires classes.

https://forums.swift.org/t/any-future-directions-for-support...

Re:Writing Gnome Apps with Swift by amomchilov on Thursday March 28, 2024 @12:50PM (#39854175)
This makes sense, observation requires a durable identity, which structs don’t have.

Two struct might be the same, but when I observe for changes in one, but not another, a distinction arises which is best captured by object-based identity