@Observable class ApplicationData {
   var mode: LayoutMode = .small
   var isLandscape: Bool = false
   var columnVisibility: NavigationSplitViewVisibility = .detailOnly

   func update(horizontalSizeClass: UserInterfaceSizeClass?) {
       let newMode: LayoutMode = horizontalSizeClass == .regular ? .large : .small
       guard mode != newMode else { return }
       mode = newMode
   }
   func updateGeometry(size: CGSize) {
       let newIsLandscape = size.width > size.height
       let newVisibility: NavigationSplitViewVisibility = newIsLandscape ? .all : .detailOnly
       guard isLandscape != newIsLandscape || columnVisibility != newVisibility else { return }
       isLandscape = newIsLandscape
       columnVisibility = newVisibility
   }
   static let shared: ApplicationData = ApplicationData()
   private init() { }
}