Search results for

swiftui

16,583 results found

Post

Replies

Boosts

Views

Activity

SwiftUI Sheet view with @Query loses model context
I've run into a strange issue. If a sheet loads a view that has a SwiftData @Query, and there is an if statement in the view body, I get the following error when running an iOS targetted SwiftUI app under MacOS 26.1: Set a .modelContext in view's environment to use Query While the view actually ends up loading the correct data, before it does, it ends up re-creating the sqlite store (opening as /dev/null). The strange thing is that this only happens if there is an if statement in the body. The statement need not ever evaluate true, but it causes the issue. Here's an example. It's based on the default xcode new iOS project w/ SwiftData: struct ContentView: View { @State private var isShowingSheet = false var body: some View { Button(action: { isShowingSheet.toggle() }) { Text(Show Sheet) } .sheet(isPresented: $isShowingSheet, onDismiss: didDismiss) { VStack { ContentSheetView() } } } func didDismiss() { } } struct ContentSheetView: View { @Environment(.modelContext) private var modelContext @Query pub
2
0
187
Nov ’25
.glasseffect with multiple date pickers
Hello, I'm having a problem with the .glasseffect modifier in a view of a SwiftUI application. I have a list that starts with a static element, followed by several dynamic entries, and then another static element. I've applied the .glasseffect modifier to all the elements, and it works fine except for the first static element. I think I've figured out what's causing it. This element contains two date pickers, and if I comment one out, it works. As soon as both are present, I get a BAD_ACCESS_ERROR. Oddly enough, this only happens on the tablet. Everything runs normally in the simulator. If I remove the .glassmodifier and use a normal background, it still works. Is this a bug, or is it against Liquid Glass to have two date pickers in a stack and then use the .glasseffect modifier?
1
0
112
Nov ’25
SwiftUI Slider onEditingChanged is unreliable on iOS 26
For information I stumbled upon a regression with SwiftUI Slider on iOS 26. Its onEditingChanged closure might be called twice when interaction ends, with a final Boolean incorrect value of true provided to the closure. As a result apps cannot reliably rely on this closure to detect when an interaction with the slider starts or ends. I filed a feedback under FB20283439 (iOS 26.0 regression: Slider onEditingChanged closure is unreliable).
7
0
452
Nov ’25
How to place scrollable header content above a Table in SwiftUI?
Hi everyone, I’m trying to reproduce the layout Apple Music uses for playlists, where there is header content above the table (artwork, title, buttons), and when you scroll, everything scrolls together—the header and table rows move as a single scrollable region. Here’s an example of what I’m trying to achieve: I’m using SwiftUI’s Table view and I haven’t found a clean way to place custom content above the table while keeping everything inside the same scroll view. Is there currently a recommended way to achieve Apple Music–style scrollable header + table content using SwiftUI? Thanks!
1
0
151
Nov ’25
Reply to Context window 90% of adapter model full after single user prompt
Hi Carina, here's the requested information: 1) Sample of training data: See attached sample.json sample.json **2) AdapterTrainingConfiguration ** config3 = AdapterTrainingConfiguration( epochs=6, learning_rate=1e-4, batch_size=2, # Try increasing if memory allows gradient_accumulation_steps=4, # Reduce accordingly enable_activation_checkpointing=True, precision='bf16-mixed', max_sequence_length=4095, compile_model=False ) train_adapter( train_data=TRAIN_FILE, eval_data=VALID_FILE, config=config3, checkpoint_dir='/content/drive/MyDrive/checkpoints' ) 3) at inference time (from my unit tests) https://github.com/MAOShea/Hello-World-Tools-Adapter-SwiftUI/blob/main/Hello%20World%20ToolsTests/LanguageModelComparisonTests.swift struct SessionFactory { static func createSession( modelType: ModelType, systemPrompt: SystemPromptVersion ) throws -> LanguageModelSession { let tools = [WriteUbersichtWidgetToFileSystem()] switch modelType { case .base: let instructions = systemPrompt.prompt return LanguageMode
Nov ’25
SwiftUI toolbar with IDs crash since macOS 15
I understand this is a known issue, but it’s truly unacceptable that it remains unresolved. Allowing users to customize toolbars is a fundamental macOS feature, and it has been broken since the release of macOS 15. How is it possible that this issue persists even in macOS 15.3 beta (24D5040f)? FB15513599 import SwiftUI struct ContentView: View { @State private var showEditItem = false var body: some View { VStack { VStack { Text(Instructions to reproduce the crash) .font(.title) .padding() Text( 1. Click on Toggle Item 2. In the menu go to File > New Window 3. In new window, click on Toggle Item ) } .padding() Button { showEditItem.toggle() } label: { Text(Toggle Item) } } .padding() .toolbar(id: main) { ToolbarItem(id: new) { Button { } label: { Text(New…) } } if showEditItem { ToolbarItem(id: edit) { Button { } label: { Text(Edit…) } } } } } }
5
0
578
Nov ’25
Reply to SwiftUI toolbar with IDs crash since macOS 15
I literally just bought a new mac studio for the sole purpose of writing a mac desktop app. The very first thing I tried on day one was to write a simple sidebar with customizable toolbar. and it crashed instantly. I'm really shocked this is a know issue and Apple has completely ignored it. Yes, I tried the remove: .sidebar hack, but the toolbar has so many bugs and it's impossible to add the toggle sidebar button and get it working with the customizer. everything goes crazy. Sample app I prepared thinking someone might give this some attention: https://github.com/sgehrman/SwiftUIAppBugs Apple developers have always been treated poorly. And Cocoa was also full of bugs. I had hoped swiftUI would finally work.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’25
Custom SF Symbols with badges not vertically centered in SwiftUI buttons
[Also submitted as FB20225387] When using a custom SF Symbol that combines a base symbol with a badge, the symbol doesn’t stay vertically centered when displayed in code. The vertical alignment shifts based on the Y offset of the badge. There are two problems with this: The base element shouldn’t move vertically when a badge is added—the badge is meant to add to the symbol, not change its alignment. The badge position should be consistent with system-provided badged symbols, where badges always appear in a predictable spot relative to the corner they're in (usually at X,Y offsets of 90% or 10%). Neither of these behaviors match what’s expected, leading to inconsistent and misaligned symbols in the UI. Screenshot of Problem The ellipsis shifts vertically whenever the badge Y offset is set to anything other than 50%. Even at a 90/10 offset, it still doesn’t align with the badge position of the system envelope.badge symbol. SF Symbols Export This seem to be a SwiftUI issue since both the export from SF
3
0
426
Nov ’25
Live Activity (Dynamic Island) suddenly stopped working without code changes
Hi everyone, I am encountering an issue where my Live Activity (Dynamic Island) suddenly became invalid and failed to launch. It was working perfectly before, and I haven't modified any code since then. My Environment: Xcode: 26.1.1 Device iOS: 26.1 Testing: I also tested on iOS 18, but the Live Activity fails to start there as well. Here is my code: Live Activity Manager (Start/Update/End): func startLiveActivity() { // Initial static data let attributes = SimpleIslandAttributes(name: Test Order) // Initial dynamic data let initialContentState = SimpleIslandState(message: Preparing...) // Adapting for iOS 16.2+ new API (Content) let activityContent = ActivityContent(state: initialContentState, staleDate: nil) do { let activity = try Activity.request( attributes: attributes, content: activityContent, pushType: nil // Set to nil as remote push updates are not needed ) print(Live Activity Started ID: (activity.id)) } catch { print(Failed to start: (error.localizedDescription)) } } // 2. Update Live Activity fun
3
0
142
Nov ’25
Reply to Unable to simultaneously satisfy constraints using versions 26.1
I'm working through various coding tutorials and have encountered the same warning numerous times. First, I must say that the symbolic breakpoint message is most unhelpful as I am developing in SwiftUI, not UIKit and have no idea where to place that breakpoint. Second, I did some experiments and found that one place the warning was coming from using the Button initializer with titleKey and systemImage parameters. A Button without systemImage did not cause the warning. I found that if instead I used the Button initializer with action and label parameters and added an Image using systemName for the label, there was no warning.
Nov ’25
CryptoTokenKit: TKSmartCardSlotManager.default is nil on macOS (Designed for iPad) but works on iPadOS and macOS
I have an iOS/iPadOS app and 'm trying to communicate with usb smart card reader using CryptoTokenKit on all platforms (ios/ipados/macos). Minimal Repro Code import CryptoTokenKit import SwiftUI struct ContentView: View { @State var status = var body: some View { VStack { Text(Status: (status)) } .padding() .onAppear { let manager = TKSmartCardSlotManager.default if manager != nil { status = Initialized } else { status = Unsupported } } } } And my entitlement file has only one key: com.apple.security.smartcard = YES Behavior • iPadOS (on device): status = Initialized ✅ • macOS (native macOS app, with the required CryptoTokenKit entitlement): status = Initialized ✅ • macOS (Designed for iPad, regardless of CryptoTokenKit entitlement): status = Unsupported → TKSmartCardSlotManager.default is nil ❌ Expectation Given that the same iPadOS build initializes TKSmartCardSlotManager, I expected the iPad app running in Designed for iPad mode on Apple silicon Mac to behave the same (or to have a documented lim
2
0
140
Nov ’25
SwiftUI navigationTransition Regression on iOS 26 (Source View Disappears + Flicker/Misaligned Geometry)
Summary I’m experiencing two issues with SwiftUI’s navigationTransition(.zoom) on iOS 26.0 and 26.1 that break previously smooth transitions. These issues appear both on real devices and Simulator. The same code works correctly on iOS 18. Issue 1 - Source View Disappears After Drag-Dismiss When using .navigationTransition(.zoom(sourceID:..., in:...)), the source view disappears completely after the transition finishes. This only happens when the detail view is dismissed via drag (interactive dismiss). When the view is dismissed by tapping the back button, the source view remains visible as expected. Reproduced on: iOS 26.0, iOS 26.0.1 (17A400), iOS 26.1 (Simulator + physical device) Issue 2 — Flickering and Geometry Mismatch During Transition Compared to iOS 18 behavior, the outgoing view and incoming view no longer share consistent geometry. Current behavior on iOS 26: The disappearing view flickers during the drag-dismiss interaction. The source and destination views no longer align geometrically.
Topic: UI Frameworks SubTopic: SwiftUI
1
0
172
Nov ’25
macOS 26: retain cycle detected when navigation link label contains a Swift Chart
I'm running into an issue where my application will hang when switching tabs. The issue only seems to occur when I include a Swift Chart in a navigation label. The application does not hang If I replace the chart with a text field. This appears to only hang when running on macOS 26. When running on iOS (simulator) or visionOS (simulator, on-device) I do not observe a hang. The same code does not hang on macOS 15. Has any one seen this behavior? The use case is that my root view is a TabView where the first tab is a summary of events that have occurred. This summary is embedded in a NavigationStack and has a graph of events over the last week. I want the user to be able to click that graph to get additional information regarding the events (ie: a detail page or break down of events). Initially, the summary view loads fine and displays appropriately. However, when I switch to a different tab, the application will hang when I switch back to the summary view tab. In Xcode I see the following messages === Attribut
3
0
215
Nov ’25
Reply to Context window 90% of adapter model full after single user prompt
Hi, I have put together a pair of unit tests that run the same scenario against two separate language models: the Apple Foundation base model, my fine-tuned adapter model. While both are able to successfully complete a first prompt/reply turn, the LanguageModelSession that is running against the adapter model runs out of context window in turn 2. A very important nuance is that while both models operate with the same system prompt: a) for the unit test running against the base model, the system prompt is passed as instructions when instantiating the LanguageModelSession b) in the unit test running against the adapter model, the system prompt is baked into the training data. Here's the link to the analysis of the behaviour of the two tests and how they differ (compiled by Claude, as you'll no doubt detect from the superb over-confidence on display that is typical of AI agents) : https://github.com/MAOShea/Hello-World-Tools-Adapter-SwiftUI/blob/main/SUPPORT_REQUEST_TranscriptStorageDifference.md The tw
Nov ’25
Reply to macOS 26: retain cycle detected when navigation link label contains a Swift Chart
I'm also experiencing this issue, but I'm not using Charts. It's when navigating back to my Home tab on macOS only. This works fine on iOS. import SwiftData import SwiftUI struct ContentView: View { @Environment(.modelContext) private var modelContext @Query private var publications: [Publication] @State private var publicationError: EncodedPublicationError? @State private var showErrorAlert = false @State private var selectedTab = 0 var body: some View { NavigationStack { TabView(selection: $selectedTab) { ScrollView { FeaturedView() RecentlyOpenedView() Spacer(minLength: 20) RecentlyUpdatedView() Spacer(minLength: 60) } .tag(0) .tabItem { Label(Home, systemImage: house.fill) } LibraryView() .tag(1) .tabItem { Label(Library, systemImage: books.vertical.fill) } QuestionView() .tag(2) .tabItem { Label(Answers, systemImage: text.bubble.fill) } SearchView() .tag(3) .tabItem { Label(Search, systemImage: magnifyingglass) } } .navigationTitle(navigationTitle) .tabViewStyle(.sidebarAdaptable) .refreshable {
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’25