Provide views, controls, and layout structures for declaring your app's user interface using SwiftUI.

SwiftUI Documentation

Posts under SwiftUI subtopic

Post

Replies

Boosts

Views

Activity

A Summary of the WWDC25 Group Lab - SwiftUI
At WWDC25 we launched a new type of Lab event for the developer community - Group Labs. A Group Lab is a panel Q&A designed for a large audience of developers. Group Labs are a unique opportunity for the community to submit questions directly to a panel of Apple engineers and designers. Here are the highlights from the WWDC25 Group Lab for SwiftUI. What's your favorite new feature introduced to SwiftUI this year? The new rich text editor, a collaborative effort across multiple Apple teams. The safe area bar, simplifying the management of scroll view insets, safe areas, and overlays. NavigationLink indicator visibility control, a highly requested feature now available and back-deployed. Performance improvements to existing components (lists, scroll views, etc.) that come "for free" without requiring API adoption. Regarding performance profiling, it's recommended to use the new SwiftUI Instruments tool when you have a good understanding of your code and notice a performance drop after a specific change. This helps build a mental map between your code and the profiler's output. The "cause-and-effect graph" in the tool is particularly useful for identifying what's triggering expensive view updates, even if the issue isn't immediately apparent in your own code. My app is primarily UIKit-based, but I'm interested in adopting some newer SwiftUI-only scene types like MenuBarExtra or using SwiftUI-exclusive features. Is there a better way to bridge these worlds now? Yes, "scene bridging" makes it possible to use SwiftUI scenes from UIKit or AppKit lifecycle apps. This allows you to display purely SwiftUI scenes from your existing UIKit/AppKit code. Furthermore, you can use SwiftUI scene-specific modifiers to affect those scenes. Scene bridging is a great way to introduce SwiftUI into your apps. This also allows UIKit apps brought to Vision OS to integrate volumes and immersive spaces. It's also a great way to customize your experience with Assistive Access API. Can you please share any bad practices we should avoid when integrating Liquid Glass in our SwiftUI Apps? Avoid these common mistakes when integrating liquid glass: Overlapping Glass: Don't overlap liquid glass elements, as this can create visual artifacts. Scrolling Content Collisions: Be cautious when using liquid glass within scrolling content to prevent collisions with toolbar and navigation bar glass. Unnecessary Tinting: Resist the urge to tint the glass for branding or other purposes. Liquid glass should primarily be used to draw attention and convey meaning. Improper Grouping: Use the GlassEffectContainer to group related glass elements. This helps the system optimize rendering by limiting the search area for glass interactions. Navigation Bar Tinting: Avoid tinting navigation bars for branding, as this conflicts with the liquid glass effect. Instead, move branding colors into the content of the scroll view. This allows the color to be visible behind the glass at the top of the view, but it moves out of the way as the user scrolls, allowing the controls to revert to their standard monochrome style for better readability. Thanks for improving the performance of SwiftUI List this year. How about LazyVStack in ScrollView? Does it now also reuse the views inside the stack? Are there any best practices for improving the performance when using LazyVStack with large number of items? SwiftUI has improved scroll performance, including idle prefetching. When using LazyVStack with a large number of items, ensure your ForEach returns a static number of views. If you're returning multiple views within the ForEach, wrap them in a VStack to signal to SwiftUI that it's a single row, allowing for optimizations. Reuse is handled as an implementation detail within SwiftUI. Use the performance instrument to identify expensive views and determine how to optimize your app. If you encounter performance issues or hitches in scrolling, use the new SwiftUI Instruments tool to diagnose the problem. Implementing the new iOS 26 tab bar seems to have very low contrast when darker content is underneath, is there anything we should be doing to increase the contrast for tab bars? The new design is still in beta. If you're experiencing low contrast issues, especially with darker content underneath, please file feedback. It's generally not recommended to modify standard system components. As all apps on the platform are adopting liquid glass, feedback is crucial for tuning the experience based on a wider range of apps. Early feedback, especially regarding contrast and accessibility, is valuable for improving the system for all users. If I’m starting a new multi-platform app (iOS/iPadOS/macOS) that will heavily depend on UIKit/AppKit for the core structure and components (split, collection, table, and outline views), should I still use SwiftUI to manage the app lifecycle? Why? Even if your new multi-platform app heavily relies on UIKit/AppKit for core structure and components, it's generally recommended to still use SwiftUI to manage the app lifecycle. This sets you up for easier integration of SwiftUI components in the future and allows you to quickly adopt new SwiftUI features. Interoperability between SwiftUI and UIKit/AppKit is a core principle, with APIs to facilitate going back and forth between the two frameworks. Scene bridging allows you to bring existing SwiftUI scenes into apps that use a UIKit lifecycle, or vice versa. Think of it not as a binary choice, but as a mix of whatever you need. I’d love to know more about the matchedTransitionSource API you’ve added - is it a native way to have elements morph from a VStack to a sheet for example? What is the use case for it? The matchedTransitionSource API helps connect different views during transitions, such as when presenting popovers or other presentations from toolbar items. It's a way to link the user interaction to the presented content. For example, it can be used to visually connect an element in a VStack to a sheet. It can also be used to create a zoom effect where an element appears to enlarge, and these transitions are fully interactive, allowing users to swipe. It creates a nice, polished experience for the user. Support for this API has been added to toolbar items this year, and it was already available for standard views.
Topic: UI Frameworks SubTopic: SwiftUI
1
0
1.2k
Jun ’25
Live Q&A Summary - SwiftUI foundations: Build great apps with SwiftUI
Here’s a recap of the Live Q&A for SwiftUI foundations: Build great apps with SwiftUI. If you participated and asked questions, thank you for coming and participating! If you weren’t able to join us live we hope this recap is useful Where can I watch the VOD? Is the sample code “Wishlist” that was shown available for download? You can view the replay of the entire event here https://www.youtube.com/watch?v=Z3vloOtZLkQ The sample code for the Wishlist app will be made available in the coming weeks on the Apple Developer website, we'll send an update via email when it is available. What are the best practices when it comes to building complex navigations in SwiftUI? The developer website has documentation on navigation style best practices. Explore navigation basics like NavigationStack and TabView to get a ground-up understanding. For documentation on navigation APIs see Navigation. How can I integrate UIKit with my SwiftUI app? What about adding SwiftUI into my UIKit app? See UIKit integration: Add UIKit views to your SwiftUI app, or use SwiftUI views in your UIKit app. Both UIKit and SwiftUI provide API to show a view hierarchy of the other. For UIKit to SwiftUI, you would use UIViewControllerRepresentable. For SwiftUI to UIKit, you would use UIHostingController. Landmarks: Interfacing with UIKit walks you through step by step how to implement UIKit in SwiftUI with UIViewControllerRepresentable, and this WWDC22 video demonstrates UIHostingController, for those that want to add SwiftUI to their UIKit. Does Wishlist feature a new iOS 26 font? How can I add custom fonts and text of my app? We’re glad to hear many of you liked wide text shown in Wishlist, however, It is the default system font with some light SwiftUI styling! Check it out for yourself in the sample code when made available, and you can learn more about customizing fonts and text by seeing Font and Applying custom fonts to text. Does Xcode have a dependency graph we can use to optimize our SwiftUI Views? Xcode comes with Instruments. Instruments is the best way to figure out what is causing excessive updates and other issues with performance. That link provides direct tutorials and resources for how to use and understand. Previews also have many useful tools for analyzing SwiftUI views, for more info see Previews in Xcode Check out this video from our latest WWDC Optimize SwiftUI performance with Instruments for information on how to use Instruments to profile and optimize your app with real-world applications If you still have questions, Check out the Instruments section of these forums and create a post so the community has the opportunity to help guide you. Are there UI debugging tools to help diagnose layout issues? Yes, Xcode also features a View Debugger located by selecting the View Debug Hierarchy, pictured below. Use the View Debugger to capture and inspect your view hierarchy, identifying which views affect window sizing. The SwiftUI Inspector also lets you examine view frames and layout behavior. See Diagnosing issues in the appearance of a running app to learn about debugging visual and layout issues. As an absolute beginner, what would be the first go-to step to go for training? Do I need prior knowledge of frameworks to get started with SwiftUI? A great place to learn how to develop for Apple platforms is with Pathways! Many developers start with Develop in Swift tutorials, which exposes you to several frameworks while teaching you the basics of SwiftUI. When you're ready to take your learning further, you can read the documentation for the specific frameworks that interest you at https://developer.apple.com/documentation/.
Topic: UI Frameworks SubTopic: SwiftUI
2
0
54
23h
How to delete a row from a table
To display rows and columns of data in a nice layout like a spreadsheet I use a table like the code here .. Table(array) { TableColumn("Ticker", value: \\.ticker) TableColumn("Other", value: \.other) } To delete a row from the table the advice is to use a ForEach loop. Since I don’t use a ForEach loop, how do I delete rows from the table ? With this code there is no way to attach a .onDelete modifier or a Button Any advice would be much appreciated Thank you
Topic: UI Frameworks SubTopic: SwiftUI
1
0
20
11h
Does anyone know how to prevent Liqud Glass from stretching when elements with the glassEffect are dragged?
When making an element with .glassEffect(.clear.interactive()) draggable, it stretches as it moves. It seems like it's meant to stretch as you move your finger away from the element, but it doesn't make sense if the element is following your finger as you drag it. Is this a bug, or is there a way to disable this behavior without removing the other "interactive" animations? P.S. The shiny border around the elements seems to be a rounded rectangle or capsule, but the actual element's shape seems to be stretched. That also appears to be a bug.
0
0
22
1d
iOS 26.3: Memory crash with @AppStorage and view transitions
I'm experiencing consistent memory crashes in iOS 26.3 (23D127) when using @AppStorage with view transitions. Environment: Device: iPhone 17 Pro Max iOS: 26.3 (23D127) Xcode: 26.2 (17C52) Issue: App crashes with "Terminated due to memory issue" when: Using @AppStorage to manage state Calling UserDefaults.set() in completion handler Transitioning to new view based on changed state Workaround: Using @State instead of @AppStorage prevents crash. Feedback: FB############ (your number) Has anyone else experienced this? Is this a known issue in iOS 26?
Topic: UI Frameworks SubTopic: SwiftUI
0
0
23
2d
.navigationDestination(isPresented hangs after reboot in watchOS when destination view contains @Environment(\.dismiss)
.navigationDestination(isPresented) hangs after reboot (when called within 2 minutes of reboot) in watchOS when destination view contains @Environment(.dismiss). Feedback: FB21077151 Second button hangs after reboot. Hangs in watchOS 26.0 and 26.4 on a physical device. struct ContentView: View { @State var presentView1 : Bool = false @State var presentView2 : Bool = false var body: some View { NavigationStack { VStack { Button("Show View 1") { presentView1.toggle() } Button("Show View 2") { presentView2.toggle() } } .navigationDestination(isPresented: $presentView1, destination: {TestView1()}) .navigationDestination(isPresented: $presentView2, destination: {TestView2()}) } } } struct TestView1: View { var body: some View { Text("View 1") } } struct TestView2: View { @Environment(\.dismiss) var dismiss var body: some View { Text("View 2") } }
2
0
59
2d
Does Liquid Glass ignore regular hit testing in SwiftUI?
I’ve encountered an aspect of the Liquid Glass effect in SwiftUI that seems a bit odd: the Liquid Glass interaction appears to ignore regular hit-testing behavior. The following sample shows a button with hit testing disabled: @main struct LiquidGlassHitTestDemo: App { var body: some Scene { WindowGroup { Button("Liquid") { fatalError("Never called.") } .buttonStyle(.glassProminent) .allowsHitTesting(false) } } } As expected, the button’s action is never called. However, the interactive glass effect still responds to touch events: What’s even more surprising is that the UIKit equivalent behaves differently: final class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let button = UIButton( configuration: .prominentGlass(), primaryAction: UIAction( title: "Liquid", handler: { action in print("Never called.") } ) ) view.addSubview(button) button.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ button.centerXAnchor.constraint(equalTo: view.centerXAnchor), button.centerYAnchor.constraint(equalTo: view.centerYAnchor) ]) button.isUserInteractionEnabled = false } } In this case, the effect is not interactive at all. Similarly, if a UIViewController’s root view overrides hitTest(_:with:) to always return nil, the Liquid Glass effect does not react to touch events whatsoever. The only way I’ve found to “properly” disable the glass interactivity in SwiftUI is to use the .disabled(true) modifier. However, this also changes the button’s appearance, which is not always desirable. Is this expected behavior, or could this be a bug? Am I missing something about how Liquid Glass interaction is implemented in SwiftUI?
0
0
22
2d
Fix text in accessory view
Do you guys know how to fix the render of the text in the accessory view ? If I force the color of text to be .black it work but it will break dark mode, but forcing it .black : .white on color scheme changes makes white to still adapt to what is behind it I have noticed that Apple Music doesn’t have that artifact and it seems to break when images are behind the accessory view // MARK: - Next Routine Accessory @available(iOS 26.0, *) struct NetxRoutinesAccessory: View { @ObservedObject private var viewModel = RoutineProgressViewModel.shared @EnvironmentObject var colorSchemeManager: ColorSchemeManager @EnvironmentObject var routineStore: RoutineStore @EnvironmentObject var freemiumKit: FreemiumKit @ObservedObject var petsStore = PetsStore.shared @Environment(\.colorScheme) private var colorScheme // Tab accessory placement environment @Environment(\.tabViewBottomAccessoryPlacement) private var accessoryPlacement // Navigation callback var onTap: (() -> Void)? @State private var isButtonPressed = false /// Explicit black for light mode, white for dark mode private var textColor: Color { colorScheme == .dark ? .trueWhite : .trueBlack } /// Returns true when the accessory is in inline/minimized mode private var isInline: Bool { accessoryPlacement == .inline } var body: some View { accessoryContent() .onTapGesture { onTap?() } } private func accessoryContent() -> some View { HStack(spacing: 12) { // Content with smooth transitions VStack(alignment: .leading, spacing: 2) { if viewModel.totalTasks == 0 { Text(NSLocalizedString("Set up routines", comment: "Routines empty state")) .font(.subheadline.weight(.medium)) .foregroundColor(textColor) } else if let next = viewModel.nextRoutineTask() { HStack(spacing: 4) { Text(NSLocalizedString("Next", comment: "Next routine prefix")) .font(.caption) .foregroundColor(textColor) Text("•") .font(.caption) .foregroundColor(textColor) Text(next.routine.name) .font(.subheadline.weight(.medium)) .foregroundColor(textColor) .lineLimit(1) } .id("routine-\(next.routine.id)-\(next.time)") .transition(.opacity.combined(with: .move(edge: .leading))) HStack(spacing: 4) { Text(viewModel.petNames(for: next.routine.petIDs)) .font(.caption) .foregroundColor(textColor) Text("•") .font(.caption) .foregroundColor(textColor) Text(Routine.displayTimeFormatter.string(from: next.time)) .font(.caption.weight(.medium)) .foregroundColor(colorSchemeManager.accentColor ?? .blue) } .id("time-\(next.routine.id)-\(next.time)") .transition(.opacity.combined(with: .move(edge: .leading))) } else { // All tasks completed Text(NSLocalizedString("All done for today!", comment: "All routines completed")) .font(.subheadline.weight(.medium)) .foregroundColor(textColor) .transition(.opacity.combined(with: .scale)) Text("\(viewModel.completedTasks)/\(viewModel.totalTasks) " + NSLocalizedString("tasks", comment: "Tasks count suffix")) .font(.caption) .foregroundColor(textColor) } } .animation(colorSchemeManager.reduceMotion ? nil : .snappy(duration: 0.3), value: viewModel.completedTasks) .animation(colorSchemeManager.reduceMotion ? nil : .snappy(duration: 0.3), value: viewModel.progress) } .padding() .contentShape(.rect) .animation(colorSchemeManager.reduceMotion ? nil : .snappy(duration: 0.35), value: viewModel.completedTasks) } }
Topic: UI Frameworks SubTopic: SwiftUI
10
2
261
2d
iMessage Extension: didSelect not called when tapping message bubbles on iPad
I'm developing a turn-based Messages game extension and experiencing a persistent issue on iPad where tapping on message bubbles does not reliably trigger lifecycle callbacks after the extension has been used once. The Problem: On iPad, after a player: Opens the extension by tapping a game message Takes their turn (plays a card) Sends the updated game state as a new message Extension collapses When the opponent sends their response and the player taps on the new message bubble, the extension often does not open. The didSelect(_:conversation:) method is not called. The user must refresh the conversation by scrolling away and back or reopening the Messages App before tapping works again. This works perfectly on iPhone - every tap on a message bubble reliably triggers didSelect and opens the extension. What I've Tried: I've implemented every lifecycle method and workaround I could find: swiftoverride func willBecomeActive(with conversation: MSConversation) { super.willBecomeActive(with: conversation) if let message = conversation.selectedMessage, let url = message.url { loadGameState(from: url, message: message, conversation: conversation) } } override func didBecomeActive(with conversation: MSConversation) { super.didBecomeActive(with: conversation) if let message = conversation.selectedMessage, let url = message.url { loadGameState(from: url, message: message, conversation: conversation) } } override func didSelect(_ message: MSMessage, conversation: MSConversation) { // This is NOT called on iPad when tapping message bubbles guard let url = message.url else { return } loadGameState(from: url, message: message, conversation: conversation) } override func didReceive(_ message: MSMessage, conversation: MSConversation) { guard let url = message.url else { return } loadGameState(from: url, message: message, conversation: conversation) } override func didTransition(to presentationStyle: MSMessagesAppPresentationStyle) { super.didTransition(to: presentationStyle) // Attempted to reload here as well } I also tried: Observing NSExtensionHostDidBecomeActive and NSExtensionHostWillEnterForeground notifications Forcing UI refresh in viewDidLayoutSubviews Checking conversation.selectedMessage in every lifecycle method Research: I found several Developer Forums threads from 2016 describing this exact issue: Thread 53167: "MSMessagesAppViewController.didSelect not called on message reselect" Thread 60323: "willSelectMessage and didSelectMessage don't fire" An Apple staff member confirmed that didSelect only fires when selecting a different message, similar to UITableView selection behavior. However, on iPad, it seems like messages remain "selected" even after the extension collapses, so tapping a new message doesn't register as a new selection. Questions: Is there a recommended way to detect when a user taps a message bubble on iPad, even if iOS considers a message "already selected"? Is there a way to programmatically deselect the current message (similar to UITableView.deselectRow) so that subsequent taps trigger didSelect? Are there any iPad-specific lifecycle methods or notifications I should be observing? Is this a known limitation of the Messages framework on iPad? Environment: Xcode 16 iOS 18 and 26 Testing on iPad Pro (M4) and iPad Air iPhone works correctly on all tested devices Any guidance would be greatly appreciated. This is blocking our App Store submission as reviewers are flagging the iPad behavior as incomplete functionality.
2
0
42
3d
Need a progress bar during init a document
I have no idea how to do it: on MacOS, in Document.init(configuration: ReadConfiguration) I decode file, and restore objects from data, which in some cases could take a long time. Document isn't fully inited, so I have no access to it. But would like to have a progress bar on screen (easier to wait for done, for now). I know size, progress value, but no idea how to make view from object during init. I know, this question may be very stupid. init(configuration: ReadConfiguration) throws { guard let data = configuration.file.regularFileContents else { throw CocoaError(.fileReadCorruptFile) } let decoder = JSONDecoder() let flat = try decoder.decode(FlatDoc.self, from: data) print ("reverting \(flat.objects.count) objects...") ///This takes time, a lot of time, need progress bar ///Total is `flat.objects.count`, current is `objects.count` /// `Show me a way to the (next) progress bar!` revertObjects(from: flat.objects) print ("...done") } update: I defined var flatObjects in Document, and I can convert in .onAppear. struct TestApp: App { @State var isLoading = false ... ContentView(document: file.$document) .onAppear { isLoading = true Task {file.document.revertObjects()} isLoading = false } if isLoading { ProgressView() } ... } But progress bar never shows, only rainbow ball
Topic: UI Frameworks SubTopic: SwiftUI Tags:
1
0
152
3d
Viewbased stereoscopic drawing
Is there a way to render stereoscopic (left/right) images in a 2d plane that resides in a swiftUI view? I know this is possible in realityKit shaders, and in immersive metal composits, but is it possible via swiftUI shaders, CAMetalLayer, etc? I'd like to draw a 2d window with standard UI chrome (resize, move etc) that displays stereoscopic content on the flat plane of the window.
1
0
606
3d
Can TextField handle undo?
I'm struggling to understand whether TextField handles undo by itself, or how to properly handle it myself. In a macOS app with a SwiftUI lifecycle, in a DocumentGroup scene, I'm using both TextEditors and Textfields. The text editors handle undo out of the box, with undo coalescing. The text fields seem not to. However, on occasion, they do create undo points, leaving me confused as to what conditions are needed for that to happen. Is there a way to reliably get text fields to handle undo on their own? Or, how should I implement typing undo, including undo coalescing, manually?
Topic: UI Frameworks SubTopic: SwiftUI
9
0
174
3d
Support for trailing accessory views in Tab (sidebarAdaptable TabView)
In iOS 18, TabView with .tabViewStyle(.sidebarAdaptable) introduced a powerful adaptive pattern — tabs in compact, sidebar in regular. However, the current Tab API only supports a title and an image (icon). There is no way to provide a trailing accessory view (e.g., a secondary icon or indicator) for sidebar rows. This is a meaningful gap in the API, because trailing accessories are a well-established pattern throughout UIKit and SwiftUI. Precedent in Apple's own design language Apple already supports trailing accessories in many analogous contexts: UITableViewCell / UICollectionViewListCell — support accessories (disclosure indicators, checkmarks, custom views) via UICellAccessory. UIListContentConfiguration — allows leading and trailing content in list rows. SwiftUI List rows — support Label, HStack with trailing elements, .badge(), and swipeActions. NavigationLink — automatically renders a disclosure chevron as a trailing accessory. UITabSidebarItem (UIKit, iOS 18) — supports configurationUpdateHandler and cell accessories at the UIKit level. The sidebar of a .sidebarAdaptable TabView is visually identical to a List — yet its rows lack the accessory support that List rows have had for years. Real-world example: Photos app Apple's own Photos app (iPadOS 18+) demonstrates this exact need. In its sidebar, the "Recently Deleted" row displays a trailing lock icon to indicate that authentication is required to view the album. This is a meaningful UX element — it communicates state at a glance, without requiring the user to tap into the item. Third-party developers building with TabView(.sidebarAdaptable) have no public API to replicate this pattern. The Tab view builder's label closure is decomposed into a discrete title and image; any additional views (including Spacer() and trailing Image views within an HStack) are silently discarded by the system. What we've tried Custom label closure with HStack — trailing views are ignored. The system extracts only the first Image and Text. .badge() modifier — only supports Int or Text, not custom views such as icons. Label with complex content — the system normalizes it to icon + title. The only viable path today is to bridge to UIKit's UITabBarController and customize UITabSidebarItem directly, which defeats the purpose of using SwiftUI's declarative TabView API. Proposed API A trailing accessory modifier on Tab, consistent with existing SwiftUI patterns: Tab("Recently Deleted", systemImage: "trash", value: "deleted") { RecentlyDeletedView() } .tabSidebarAccessory { Image(systemName: "lock.fill") .foregroundStyle(.secondary) } // Option B: Text accessory (e.g., counts, status labels) Tab("Inbox", systemImage: "tray", value: "inbox") { InboxView() } .tabSidebarAccessory { Text("12") .font(.subheadline) .foregroundStyle(.secondary) } // Option C: Combined text + image accessory Tab("Shared Albums", systemImage: "rectangle.stack", value: "shared") { SharedAlbumsView() } .tabSidebarAccessory { HStack(spacing: 4) { Text("3 new") .font(.caption) .foregroundStyle(.secondary) Image(systemName: "person.2.fill") .foregroundStyle(.blue) } } Environment Platform: iPadOS / macOS Catalyst iOS version: 18.0+ Xcode: 16.0+ Component: SwiftUI TabView with .tabViewStyle(.sidebarAdaptable) Summary The Tab API should support trailing accessory content for sidebar rows, bringing it in line with the accessory support already available in UITableViewCell, UICollectionViewListCell, UIListContentConfiguration, and SwiftUI List. Apple's own Photos app demonstrates the need for this capability, yet no public API exists for third-party developers to achieve it.
2
0
57
3d
sharedBackgroundVisibility Not Removing Spacing
Any logical reason why applying .sharedBackgroundVisibility(.hidden) to a ToolbarItem would not remove the spacing allocated for glass border? Thus causing any element utilizing this functionality to appear offset from the regular buttons. Or is this yet another magical Apple experience I am not blessed enough to understand.
4
0
89
3d
Button in ToolbarItem is not completely tapable on iOS 26
I have an icon button in toolbar but only the icon is triggering tap events while outside icon button gives tap feedback but event is not firing. Code: ToolbarItem(placement: .navigationBarTrailing) { Button(action: toggleBookmark) { Image(systemName: isBookmarked ? "bookmark.fill" : "bookmark") .resizable() .aspectRatio(0.8, contentMode: .fit) .frame(width: 20, height: 20) } } Here toggleBookmark function is only called if I click on Image but not if I click outside image but on the circular button that appears on iOS 26. See this screen recording.
Topic: UI Frameworks SubTopic: SwiftUI
3
1
81
4d
WidgetKit: WidgetCenter.reloadAllTimelines() / reloadTimelines(ofKind:) requests are silently ignored/deferred, causing widget to remain unupdated UI Frameworks SwiftUI
Problem After launching the host app by tapping the widget (widgetURL), calls to: WidgetCenter.shared.reloadAllTimelines() WidgetCenter.shared.reloadTimelines(ofKind: ...) are ignored/deferred for an initial period right after the app opens. During this window, the widget does not reload its timeline and remains unupdated, no matter how many times I call the reload methods. After some time passes (typically ~30 seconds, sometimes shorter/longer), reload calls start working again. There is also no developer-visible signal (no callback/error/acknowledgement) that the reload was ignored, so the app can’t detect the failure and can’t reliably recover the flow. Question: Is this expected behavior (throttling/cooldown) after opening the app from a widget ? If so, is there any recommended workaround to update the widget reliably and quickly (or at least detect that the reload was not accepted)? Any guidance would help.
0
0
54
4d
dropDestination does not work inside List
I've discovered an issue with using iOS 16's Transferable drag-and-drop APIs for SwiftUI. The dropDestination modifier does not work when applied to a subview of a List. This code below will not work, unless you replace the List with a VStack or any other container (which, of course, removes all list-specific rendering). The draggable modifier will still work and the item will drag, but the dropDestination view won't react to it and neither closure will be called. struct MyView: View { var body: some View { List { Section { Text("drag this title") .font(.largeTitle) .draggable("a title") } Section { Color.pink .frame(width: 400, height: 400) .dropDestination(for: String.self) { receivedTitles, location in true } isTargeted: { print($0) } } } } } Has anyone encountered this bug and perhaps found a workaround?
9
0
3.7k
4d