Post

Replies

Boosts

Views

Activity

Reply to Broken Constraints on macOS 26 SwiftUI App
I've been heavily working with this beta since v1, and I've received this error, and many others relating to NavigationSplitView. However, I believe every time it was relating to an issue in my code. Various things to look out for: inspector, if you have a parent view with specific frame requirements, inset rules, custom layouts, etc. Keep in mind I just recently picked up Swift + SwiftUI -- so I could be leaving out other important considerations. If I were you, I would look at that error message -- here's a snippet that should help you debug your layout that is called out specifically: import SwiftUI @main struct Application: App { #if os(macOS) // @NSApplicationDelegateAdaptor(Delegate.self) var delegate #endif init() { #if DEBUG && os(macOS) // Layout constraint debugging UserDefaults.standard.set(true, forKey: "NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints") #endif } var body: some Scene { WindowGroup { Features.Shell.UI.Main() .windowResizeAnchor(.center) } } } I apologize formatting may not be perfect
Topic: UI Frameworks SubTopic: SwiftUI
Jul ’25
Reply to Using .glassEffect in Charts
Hello! I was able to get a couple of patterns down for glass in charts; some through views and others with chart-specific protocols. here's an example .annotation: extension Charting.Views.Stock.Selection { struct Annotation: View { private let low: Double private let high: Double private let open: Double private let close: Double private let gain: Bool private var time: String public init(_ data: Charting.Model.Candle) { self.low = data.low self.high = data.high self.open = data.open self.close = data.close self.gain = data.gain self.time = data.date.formatted(.dateTime.hour().minute().timeZone(.exemplarLocation)) } @Environment(\.colorScheme) private var colors var body: some View { VStack(alignment: .leading) { Group { HStack { Text("Low").font(.caption) Spacer() Text(low, format: .currency(code: "USD")) } HStack { Text("High").font(.caption) Spacer() Text(high, format: .currency(code: "USD")) } Divider() HStack { Text("Open").font(.caption) Spacer() Text(open, format: .currency(code: "USD")) } HStack { Text("Close").font(.caption) Spacer() Text(close, format: .currency(code: "USD")) } HStack { Spacer() Text(gain ? "+" : "-") Text(abs(open - close), format: .currency(code: "USD")) } Divider() HStack { Spacer() Text(time) } } .foregroundStyle(colors == .dark ? Color.white : Color.black) } .padding() .glassEffect( .regular.tint( gain ? Color("Chart-Candle-Green").opacity(0.25) : Color("Chart-Candle-Red").opacity(0.25) ), in: RoundedRectangle(cornerRadius: 8, style: .circular) ) .background( RoundedRectangle(cornerRadius: 8, style: .circular) .fill( .ultraThinMaterial.opacity(0.25) ) ) .opacity(0.25) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’25