Search results for

swiftui

16,582 results found

Post

Replies

Boosts

Views

Activity

Skybox for iOS/swiftUI not working
I have tried every combination of suggestions to get a skybox to appear. Using swiftUI, realityKit and iOS. Non immersive environment. Does anyone have code that works to display a skybox. When i use a do/catch loop i get environmentResource not found. I have checked the syntax, ensured the folder is referencing the target, used the same name for the folder as the file, the file is a .hdr (i assume this is supported), i have moved the file folder to the top level - no change.
2
0
482
3w
Locking App Orientation to Landscape in Playground
Hello! I’m building my Swift Student Challenge project in Swift Playgrounds, and I’ve run into an issue with app orientation. Since this is a game, the layout and interactions only work correctly in landscape, but Playgrounds doesn’t offer the usual orientation settings you’d configure in Xcode. Is there a recommended way to force a landscape-only experience in Swift Playgrounds using SwiftUI? Any workarounds or guidance would be greatly appreciated! Thank you!
0
0
57
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
4w
How to present a view in SwiftUI on the top of any other view, even if there is already a view presented
I have a SwiftUI app that needs to present a fullScreenCover when the user opens a deep link. This screen must appear above anything currently shown — even if another fullScreenCover is already being presented. In UIKit, I can achieve this by walking the view controller hierarchy, finding the top-most view controller, and presenting the new full-screen view from there. What is the recommended way to reproduce this behavior in SwiftUI? How can I ensure a fullScreenCover is always shown above the current presentation layer, regardless of the app’s UI state?
Topic: UI Frameworks SubTopic: SwiftUI
0
0
79
4w
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
RealityKit, Attachments - not working
The simplest realityView (content, attachments in ... causes Contextual closure expects 1 argument but 2 were used in closure body. I have checked every example and i cannot understand why i get this error regardless of any content. Note: i have added Attachment(id: test) to the attachment closure and get Attachment not is scope. imported both realityKit and SwiftUI.
2
0
218
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
Can SwiftUI Views serve as delegates?
Structs are value types, and the SwiftUI gets reinitialized many times throughout its lifecycle. Whenever it gets reinitialized, would the reference that the delegator has of it still work if the View uses @State or @StateObject that hold a persistent reference to the views data? protocol MyDelegate: AnyObject { func didDoSomething() } class Delegator { weak var delegate: MyDelegate? func trigger() { delegate?.didDoSomething() } } struct ContentView: View, MyDelegate { private let delegator = Delegator() @State counter = 1 var body: some View { VStack { Text((counter)) Button(Trigger) { delegator.trigger() } } } func didDoSomething() { counter += 1 //would this call update the counter in the view even if the view's instance is copied over to the delegator? } }
0
0
43
4w
DeviceActivity Report Extension cannot pass App Store Connect validation without becoming un-installable on device
I'm running into a contradictory requirement involving the DeviceActivity Report extension (com.apple.deviceactivityui.report-extension) that makes it impossible to both: upload the app to App Store Connect, and install the app on a physical device. This creates a complete catch-22. 📌 Overview My extension: Path: Runner.app/PlugIns/LoADeviceActivityReport.appex Extension point: com.apple.deviceactivityui.report-extension Implementation (SwiftUI): import SwiftUI import DeviceActivity @main struct LoADeviceActivityReport: DeviceActivityReportExtension { var body: some DeviceActivityReportScene { // ... } } This is the standard SwiftUI @main DeviceActivityReportExtension template. 🟥 Side A — iOS runtime behavior (device installer) If I add either of these keys to the extension's Info.plist: NSExtensionPrincipalClass NSExtensionMainStoryboard then the app cannot be installed on a real iPhone/iPad. The device installer fails with: Error 3002 AppexBundleContainsClassOrStoryboard NSExten
3
0
178
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:
4w
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
Should TabView with .page style support keyboard left/right navigation automatically?
I’m trying to understand the expected behavior of TabView when using .tabViewStyle(.page) on iPadOS with a hardware keyboard. When I place a TabView in page mode, swipe gestures correctly move between pages. However, left and right arrow keys do nothing by default, even when the view is made focusable. This feels a bit surprising, since paging with arrow keys seems like a natural keyboard interaction when a keyboard is attached. Right now, to get arrow-key navigation working, I have to manually: Make the view focusable Listen for arrow key presses Update the selection state manually This works, but it feels a little tedious for something that seems like it could be built-in. import SwiftUI struct PageTabsExample: View { @State private var selection = 0 private let pageCount = 3 var body: some View { TabView(selection: $selection) { Color.red.tag(0) Color.blue.tag(1) Color.green.tag(2) } .tabViewStyle(.page) .indexViewStyle(.page) .focusable(true) .onKeyPress(.leftArrow) { guard selection > 0 else
0
0
110
Dec ’25
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
Dec ’25