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.
Search results for
swiftui
16,582 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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!
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Swift Student Challenge
Swift Playground
Playground Support
SwiftUI
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?
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
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
Topic:
Community
SubTopic:
Swift Student Challenge
Tags:
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.
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
Topic:
App & System Services
SubTopic:
Processes & Concurrency
Tags:
Filed https://feedbackassistant.apple.com/feedback/21260457 When a SwiftUI app uses both a DocumentGroupLaunchScene and a TabView (no matter how trivial) in its Content view, it hangs on 26.1 (both simulator and device), with high CPU utilization in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] and memory usage increasing rapidly. This did not happen in 26.0
Topic:
UI Frameworks
SubTopic:
SwiftUI
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? } }
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? It wasn't mentioned in the video.
Topic:
App & System Services
SubTopic:
Processes & Concurrency
Tags:
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
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:
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:
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
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