Search results for

swiftui

16,583 results found

Post

Replies

Boosts

Views

Activity

Live Activity Shows Only Black Dynamic Island UI (No Content Rendering) — Widget Extension Receives Updates but SwiftUI UI Is Empty
Hi all, very new developer trying to build my own app. The app works, just trying to improve it. I’m implementing a Live Activity in a widget extension (Swift/SwiftUI) for an app built with Flutter as the host app. ActivityKit is functioning correctly—activities start, update, and end normally, and the widget extension receives all state updates. However, the Live Activity UI renders as a completely black capsule (both compact and expanded Dynamic Island, as well as the Lock Screen presentation). The system shows the Live Activity container, but none of the SwiftUI content displays. Verified so far: ActivityAttributes contains at least one stored property (previously empty). ContentState fully Codable + Hashable. All Dynamic Island regions return visible test UI (Text/Image). No .containerBackground() usage. Added explicit .activityBackgroundTint() + system foreground colors. All Swift files included in widget extension target. No runtime errors, no decode failures, no SwiftUI logs.
3
0
137
Nov ’25
Source item disappears after swipe-back with .navigationTransition(.zoom)
[Submitted as FB21078443] When using .matchedTransitionSource with .navigationTransition(.zoom), swiping back from the left edge to return from a detail view causes the source item to disappear once the transition finishes. It’s only a visual issue—the item is still there and can be tapped to open again. This doesn’t happen when using the Back button; only the swipe-back gesture triggers it. Also, it only reproduces on a physical device, not in Simulator. SYSTEM INFO Xcode 26.1.1 (17B100) macOS 26.1 (25B78) iOS 26.1 (23B85) iOS 26.2 (23C5044b) REPRO STEPS Run the code below on a physical device, tap an image, then swipe from the left edge to dismiss the detail view. ACTUAL The image zooms back to its origin, then disappears once the animation settles. EXPECTED The image card remains visible. SCREENSHOTS CODE import SwiftUI struct Item: Identifiable, Hashable { let id = UUID() let imageName: String let title: String } struct ContentView: View { @Namespace private var namespace let items = [ Item(image
Topic: UI Frameworks SubTopic: SwiftUI
2
0
104
Nov ’25
Snippet Views don't render consistently, width not always respected
I've created a Snippet for my iOS app which I want to be able to run from the LockScreen via a Shortcuts widget. All works fine except when I run the shortcut and the App Snippet appears, it doesn't always render the SwiftUI view in the same way. Sometimes the width boundaries are respected and sometimes not. I've tested this on iOS 26.1 and iOS 26.2 beta 3 I think this is a bug but it would be great if anyone could see what I might be doing wrong if it's not. Incase it is a bug I've filed a feedback (FB21076429) and I've created a stripped down sample project showing the issue and added screenshots showing the issue. Basic code to reproduce issue: // Intent.swift // SnippetBug import AppIntents import Foundation import SwiftUI struct SnippetEntryIntent: AppIntent { static let title: LocalizedStringResource = Open Snippet static let description = IntentDescription(Shows a snippet.) // Don’t open the app – stay in the snippet surface. static let openAppWhenRun: Bool = false func perform() asy
0
0
96
Nov ’25
Severe Scroll Lag & Header Flickering in Complex SwiftUI Screen with Dynamic Content (GeometryReader + Scroll Direction Detection)
I’m working on a SwiftUI screen where I need to hide a header when the user scrolls down and show it again when the user scrolls up. I’m currently using a ScrollView combined with GeometryReader to detect scroll offset changes and update state variables like isScrolling or isScrollingDown. The issue is that the behavior is inconsistent. When I scroll down, the header hides correctly, but when I scroll back up, the header often doesn’t appear again even though the offset is changing. Sometimes the header comes back with a delay, and other times it never appears at all. Along with this, I’m also seeing noticeable UI lag whenever I try to calculate content height or read multiple geometry values inside the ScrollView. It looks like the frequent state updates inside the scroll offset tracking are causing layout recalculations and frame drops. I’ve tried placing the header in different positions (inside a ZStack aligned to the top, inside the VStack above the ScrollView, and with transitions like .push(fr
2
0
106
Nov ’25
Reply to how to navigate programmatically without navigation link?
Use navigationDestination(isPresented:destination:) and hide the Back button at the destination View? import SwiftUI struct ContentView: View { @State var goToHello = false var body: some View { NavigationStack { Button { goToHello = true } label: { Text(Go to Hello?) } .navigationDestination(isPresented: $goToHello) { HelloView() } } } } #Preview { ContentView() } struct HelloView: View { var body: some View { NavigationStack { VStack { Text(Hello!) } .navigationBarBackButtonHidden() } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’25
how to navigate programmatically without navigation link?
Hello. I'm making an app with several different views. I'm trying to switch views using a button but I can't seem to figure out how. I know Navigation Links work, but my case doesn't work. The reasons for this are because I need to run other code when they click the button and I don't want them to be able to navigate back (to CustomizationView/CreateAccountView). I know that you can hide the back button but my problem with that is the fact that i will be navigating to a view (MainView) that will also have navigation buttons in it, so if i'm thinking correctly, the button will be hidden but when they press the next navigationlink (in MainView) it will show again and then they can go back (to CustomizationView/CreateAccountView). i don't want them to go back because they will be navigating from a login/account view that wont be needed anymore. I'm currently using .fullScreenCover() and it works fine except for performance (I'm assuming). here's the code: import SwiftUI struct CustomizationView: View {
2
0
110
Nov ’25
Recommended Way to Implement Digital Crown Zoom + Drag for Images on watchOS
I’m trying to implement smooth zoom and drag interactions for an image on watchOS—similar to the Photos app. DTS recommended using digitalCrownRotation + scaleEffect in SwiftUI, and ChatGPT also suggests a similar approach. However, the experience still isn’t as smooth or polished as the Photos app. Before I commit fully to this direction, I want to confirm: 1. Is SwiftUI with digitalCrownRotation, scaleEffect, and DragGesture the officially recommended approach for zoom + pan on watchOS? 2. Is there any public API that provides built-in Photos-style behavior, or is a custom SwiftUI implementation expected? 3. Are there best-practice patterns for smooth scaling, maintaining image bounds, and constrained panning? Thanks for any guidance
Topic: UI Frameworks SubTopic: SwiftUI
1
0
91
Nov ’25
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
Unable to create SwiftUI previews in Xcode 26 for iOS 15.5
I am getting this error msg when I try to run a SwiftUI Preview on an iOS 15.5 simulator: Termination Reason: Namespace DYLD, Code 1, Library missing | Library not loaded: /usr/lib/swift/libswift_StringProcessing.dylib | Referenced from: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libLiveExecutionResultsLogger.dylib | Reason: tried: '/Users/hfg/Library/Developer/Xcode/DerivedData/Testios15sim-aawlbfbtggzozseoekycwwpadhrc/Build/Intermediates.noindex/Previews/iphonesimulator/Testios15sim/Products/Debug-iphonesimulator/libswift_StringProcessing.dylib' (no such file), '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 15.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/libswift_StringProcessing.dylib' (no such file), '/usr/lib/swift/libswift_StringProcessing.dylib' (no such file), '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 15.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libswift_StringProcessing.dylib' (no
1
0
133
Nov ’25
Tip always displayed with TipKit
Why a TipKit configured with a weekly frequency, on the following example, when the app is launched on the View1, the tip is displayed. I thought that going to View2 and come back to View1 should not redisplayed the tip (at least until one week). What do I miss? import SwiftUI import TipKit struct FavoriteLandmarkTip: Tip { var title: Text { Text(Save as a Favorite) } var message: Text? { Text(Your favorite landmarks always appear at the top of the list.) } var image: Image? { Image(systemName: star) } } @main struct LandmarkTips: App { var body: some Scene { WindowGroup { TabView { View1() .tabItem { Label(View1, systemImage: house) } View2() .tabItem { Label(View2, systemImage: house) } } .task { do { // uncomment to reset all tips status // try? Tips.resetDatastore() try Tips.configure([ .displayFrequency(.weekly), .datastoreLocation(.applicationDefault) ]) } catch { print(Error initializing TipKit (error.localizedDescription)) } } } } } struct View1: View { let favoriteLandmarkTip = FavoriteLandm
1
0
63
Nov ’25
Layout issues occur when the Picker style is segmented on macOS.
When I run the following code and change Is On, I get a problem with the layout of the Picker. There is no problem when using Text(), but when using only Image, it works fine on iOS but there is a problem on macOS. Tested on macOS 26.1, Xcode 26.1. import SwiftUI struct ContentView: View { @State var model = Model() var body: some View { Form { Picker(Category, selection: $model.category) { ForEach(Category.allCases) { item in Image(systemName: item.icon) .tag(item) } } .pickerStyle(.segmented) Toggle(Is On, isOn: $model.isOn) } .formStyle(.grouped) } } struct Model { var category: Category = .a var isOn: Bool = false } enum Category: Int, Identifiable, CaseIterable { case a, b, c var id: Int { rawValue } var icon: String { switch self { case .a: return a.circle.fill case .b: return b.circle.fill case .c: return c.circle.fill } } var name: String { switch self { case .a: return a case .b: return b case .c: return c } } } code-block
1
0
54
Nov ’25
SwiftUI .toolbar(placement: .keyboard) item not exposed to accessibility on iOS 26.1 (affects VoiceOver + XCUITest)
Description On iOS 26.1, a ToolbarItem placed in .keyboard is no longer exposed to the accessibility hierarchy. As a result: VoiceOver cannot focus or activate the toolbar button XCUITest cannot discover the element, making the UI impossible to test TextEditor() .toolbar { ToolbarItem(placement: .keyboard) { Button(Done) { /* action */ } } } This worked correctly on previous iOS versions. The button appears visually but is missing from both VoiceOver navigation and XCUI accessibility queries. Steps to Reproduce Create a new SwiftUI project. Use a simple text field with a keyboard toolbar button. Run on an iOS 26.1 device or simulator. Focus the text field to show the keyboard. Turn on VoiceOver and attempt to navigate to the toolbar button. Run an XCUITest attempting to locate the button
1
0
92
Nov ’25
Reply to SwiftUI Instrumentation Fails to start
Hello Im having similar issues, however with Instrumenting a macOS application. Instruments + SwiftUI was working great with XCode 16.3 and macOS 15.5 I recently updated to macOS 15.7.2 and XCode 26.1.1 And now When I run my application via Product -> Profile (Command I) SwiftUI Template Run Instruments launches my app for a microsecond, and then fails with Failed to start the recording: Failed starting ktrace session. Some notes For my macOS target, i can only choose deferred mode for the Recorder Settings
Nov ’25
Reply to Spatial Audio on iOS 18 don't work as inteneded
For completeness, this is the view I'm experimenting with: import AVFoundation import SwiftUI class EngineerPlayer { let audioEngine = AVAudioEngine() let playerNode = AVAudioPlayerNode() let environmentNode = AVAudioEnvironmentNode() init(_ url: URL) throws { let audioFile = try AVAudioFile(forReading: url) let mono = AVAudioFormat(standardFormatWithSampleRate: audioFile.processingFormat.sampleRate, channels: 1) let stereo = AVAudioFormat(standardFormatWithSampleRate: audioFile.processingFormat.sampleRate, channels: 2) audioEngine.attach(playerNode) audioEngine.attach(environmentNode) audioEngine.connect(playerNode, to: environmentNode, format: mono) audioEngine.connect(environmentNode, to: audioEngine.mainMixerNode, format: stereo) audioEngine.prepare() try audioEngine.start() environmentNode.renderingAlgorithm = .HRTFHQ playerNode.pointSourceInHeadMode = .mono playerNode.position = AVAudio3DPoint(x: 0, y: 2, z: 10) playerNode.scheduleFile(audioFile, at: nil, completionHandler: nil) } func updatePo
Topic: Media Technologies SubTopic: Audio Tags:
Nov ’25