Search results for

swiftui

16,582 results found

Post

Replies

Boosts

Views

Activity

SwiftUI sheet with TextField using autocorrectionDisabled() prevents view model deinit after editing
I present a view as a sheet that contains a TextField and a viewModel. The sheet uses .autocorrectionDisabled() on the TextField. If I open the sheet and dismiss it without editing, the viewModel is released as expected. But if I edit the TextField and then dismiss the sheet, the viewModel is not deinitialized (it remains retained). Test Outputs: // # Present 1st time - Correct ✅ TestViewModel - init - 0x0000600000c12ee0 // Dismiss wihtout editing, deinitialized correctly TestViewModel - deinit - 0x0000600000c12ee0 // # Present 2st time - Incorrect ❌ TestViewModel - init - 0x0000600000c006c0 // Edit and dismiss, no deinit here // # Present 3rd time - Incorrect ❌ TestViewModel - init - 0x0000600000c113b0 // Enter text field to edit will deinit previous one TestViewModel - deinit - 0x0000600000c006c0 // Dismiss, no deinit // TestViewModel (0x0000600000c113b0) remains retained ⚠️ Using .autocorrectionDisabled(true) gives the same problem. Removing or commenting out .autocorrectionDisabled() fixes the issue, but
Topic: UI Frameworks SubTopic: SwiftUI
1
0
156
3w
Editable OutlineGroup
A SwiftUI List on Mac can contain a ForEach, which implements DynamicViewContent and thus provides automatic drag & drop editing with onInsert, onDelete and onMove. How can this editing by accomplished with the new hierarchical OutlineGroup?
3
0
1.1k
Sep ’20
Attributes inspector in Xcode 26
It has been two years since I wrote my a SwiftUI app, and I wanted to start again in Xcode 26. I can no longer see the attributes inspector when I select an element in the canvas. This was an Xcode feature that was very helpful as I am still a novice. Has this feature been deprecated in Xcode 26? And if not, please help explain how I can find and use it.
3
0
339
3w
NSButtons disappear on macOS 26
I have attached 2 images of our Mac Apps user interface. The app is built for macOS 15.6 or newer. On macOS 15 and earlier everything looks fine. But the same App running on macOS 26 the controls disappear. We were able to temporarily resolve the problem by adding UIDesignRequiresCompatibility to the info.plist. This type of nonsense happens all over the app without the compatibility switch. Shouldn't all these legacy controls be backward compatible on Glass? This part of the app where the controls are disappearing is built in Swift (not swift ui) and uses standard programatic layout and visual constraints. On macOS 26, there are no Xcode warnings or layout errors on the console relative to the layout so we are confused as to how we would resolve this without the use of UIDesignRequiresCompatibility. Is this some kind of bug in NSControl glass compatibility? We are not likely to move the entire app into SwiftUI anytime soon. How would we resolve this?
4
0
331
3w
Reply to Announcing the Swift Student Challenge 2026
I recommend that you put this question into a new thread. That way it’s more likely to attract the attention of folks with expertise in this area. Use the UI Frameworks > SwiftUI subtopic and apply any relevant tags, like Swift Student Challenge and maybe Swift Playground. Good luck with your code efforts. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
4w
Display .icon files in SwiftUI
Is there a way to display a .icon file in SwiftUI? I want to show the app icon in the app itself but exporting and including the app icon as a PNG feels redundant. This would consume a lot of unnecessary storage especially when including a lot of alternative app icons. There has to be a better way Otherwise I would file a feedback for that Thank you
1
0
225
4w
Reply to How is BGContinuedProcessingTask intended to be used?
Sorry to barge in on this thread, but I am completely unable to get BGContinuedProcessingTask to work in a UIKit app (the task never starts, the heads-up progress never appears), even though the very same code in a SwiftUI app works just fine. Is this by design? No, it should work fine in UIKit. it turns out that the task ID must begin with the app's bundle ID exactly. ...but, yes, this is required. Sorry for the noise — Not a problem, it mistakes happen. __ Kevin Elliott DTS Engineer, CoreOS/Hardware
4w
Popovers are broken on macCatalyst
.popover(isPresented: modifier doesn't work on Mac Catalyst when attached to the item in the toolbar. The app crashes on button click, when trying to present the popover. iOS 26 RC (macOS 26 RC) Feedback ID - FB20145491 import SwiftUI struct ContentView: View { @State private var isPresented: Bool = false var body: some View { NavigationStack { Text(Hello, world!) .toolbar { ToolbarItem(placement: .automatic) { Button(action: { self.isPresented.toggle() }) { Text(Toggle popover) } .popover(isPresented: $isPresented) { Text(Hello, world!) } } } } } } #Preview { ContentView() }
3
0
338
2w
Buttons on tvOS with text are blurred
When adding buttons to a sheet, on tvOS the text is blurred in the buttons, making it illegible. Feedback: FB21228496 (used GPT to extract an example from my project for a test project to attach here) // ButtonBlurTestView.swift // Icarus // // Test view to reproduce blurred button issue on tvOS // import SwiftUI struct ButtonBlurTestView: View { @State private var showSheet = false @State private var selectedTags: [Int] = [] @State private var newTagName: String = // Hardcoded test data private let testTags = [ TestTag(id: 1, label: Action), TestTag(id: 2, label: Comedy), TestTag(id: 3, label: Drama), TestTag(id: 4, label: Sci-Fi), TestTag(id: 5, label: Thriller) ] var body: some View { NavigationStack { VStack { Text(Button Blur Test) .font(.title) .padding() Button(Show Test Sheet) { showSheet = true } .buttonStyle(.borderedProminent) .padding() Text(Tap the button above to open a sheet with buttons inside a Form.) .font(.caption) .foregroundColor(.secondary) .multilineTextAlignment(.center) .pad
Topic: UI Frameworks SubTopic: SwiftUI Tags:
1
0
138
4w
Reply to .confirmationDialog not working as expected in iOS 26.1
Thank you for your post. And thanks for the 2 images showing the behavior for the confirmation dialog: https://developer.apple.com/documentation/swiftui/view/confirmationdialog(_:ispresented:titlevisibility:presenting:actions:)-9ibgk A comprehensive documentation exists regarding Liquid Glass, which may explain certain changes. However, it is noteworthy that controls now exhibit subtle variations in default behavior to align with the updated UI. While you can still anchor or modify controls to achieve your desired outcomes, I personally recommend retaining the new iOS behavior. https://developer.apple.com/documentation/technologyoverviews/adopting-liquid-glass However, if the default behavior of any control does not align with your requirements, I recommend customizing it instead of requesting an enhancement. I see you are using iOS 26.1 simulator, have you downloaded the new Xcode in beta and try the new beta iOS simulators? Albert Pascual
  Worldwide Developer Relations.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’25
Reply to What would you say to someone who is new to iOS?
You get lost when you try what ? If that may be useful, my advice is to get focused. You have learned the basics (of Swift, SwiftUI, Xcode…). Even if you are not yet an expert, that is good enough for second step. Focus: Imagine a simple app that you would be pleased to use for yourself (think of some pain points you have in your daily life that an app could help solve). Then go and develop the app. Going through all the development steps will let you put in practice what you have learned and then better understand how all this works. For sure you will face issues you cannot manage: ask for help on the forum. Once you app is completed, you will see you have learned a lot. And be ready to think of an app for the AppStore. Good luck.
Topic: Community SubTopic: Apple Developers Tags:
Dec ’25
iOS 18.1 crash UIHostingView.layoutSubviews() / swift_unknownObjectWeakAssign / objc_storeWeak
We're seeing sporadic crashes on devices running iOS 18.1 - both beta and release builds (22B83). The stack trace is always identical, a snippet of it below. As you can tell from the trace, it's happening in places we embed SwiftUI into UIKit via UIHostingController. Anyone else seeing this? 4 libobjc.A.dylib 0xbe2c _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 30 5 libobjc.A.dylib 0xb040 weak_register_no_lock + 396 6 libobjc.A.dylib 0xac50 objc_storeWeak + 472 7 libswiftCore.dylib 0x43ac34 swift_unknownObjectWeakAssign + 24 8 SwiftUI 0xeb74c8 _UIHostingView.base.getter + 160 9 SwiftUI 0x92124 _UIHostingView.layoutSubviews() + 112 10 SwiftUI 0x47860 @objc _UIHostingView.layoutSubviews() + 36
9
0
1.3k
Dec ’25
Menu presentation in UIHostingController issues
Looking to see if anyone has experienced this issue, and is aware of any workarounds. With an app migrating towards SwiftUI Views but still using UIKit for primary navigation, my app makes use of UIHostingController to push SwiftUI Views onto a UINavigationController stack in a lot of areas. With iOS 26, I notice that SwiftUI's Menu view really struggles to present when contained in a UIHostingController. An error is logged to the console on presentation, and depending on the UI, the Menu won't present inside of it's container, or will jump around the screen. The bug, it seems is based in a private class UIReparentingView and I am curious if anyone has found a work around for this issue. The error reported is: Adding '_UIReparentingView' as a subview of UIHostingController.view is not supported and may result in a broken view hierarchy. Add your view above UIHostingController.view in a common superview or insert it into your SwiftUI content in a UIViewRepresentable instead.
7
0
718
Dec ’25