Post

Replies

Boosts

Views

Activity

Alert within Popover is clipped in height causing title to be hidden
When showing an Alert from within a Popover that has a fixed height, the newly presented Alert is in the same position but gets limited by the Popovers height causing the title of the Alert to be hidden. Is this intentional behavior or are Alerts not supported within Popovers and I'd have to pass it through to my main view? Code: // // DemoalertPopover.swift // ******** // // Created by Thilo on 26.06.2023. // import SwiftUI struct DemoAlertPopover: View { @Environment(\.dismiss) var dismiss @State private var showDeleteConfirmation = false let dateFormatter: DateFormatter = { let formatter = DateFormatter() formatter.dateFormat = "dd.MM.yyyy" return formatter }() var body: some View { VStack(alignment: .leading, spacing: 0) { HStack { Text("Title").font(.extraLargeTitle).lineLimit(1) Spacer() Button(action: { dismiss() }) { Label("Close", systemImage: "xmark").labelStyle(.iconOnly) } } HStack(alignment: .center) { Text("Content").font(.largeTitle) Text("Content2").foregroundStyle(.secondary) } LazyVGrid(columns: [GridItem(.flexible(), spacing: 10),GridItem(.flexible(), spacing: 10),], spacing: 10) { Button(action: { showDeleteConfirmation = true }) { ZStack{ Image(systemName: "trash.fill").resizable().foregroundColor(.primary) }.aspectRatio(1/1,contentMode: .fit) .frame(maxWidth: .infinity).padding(5) }.aspectRatio(3/1,contentMode: .fit) }.alert("Are you sure you want to delete ...?", isPresented: $showDeleteConfirmation) { Button("Trash",role: .destructive, action: { print("Deleted") dismiss() }) Button("Cancel", role: .cancel) {} } message: { Text("This is a small message below the title, just so you know.") } } .padding(.all, 10).frame(width: 300) } } #Preview { DemoAlertPopover() } Video: https://www.youtube.com/shorts/31Kl7qbJIiA
2
0
858
Oct ’25
visionOS Window launch size
Before visionOS Beta 4 it was possible to define the launch size in the Info.plist using PreferredLaunchSize like so: <key>UILaunchPlacementParameters</key> <dict> <key>PreferredLaunchSize</key> <dict> <key>Height</key> <integer>750</integer> <key>Width</key> <integer>750</integer> </dict> </dict> In visionOS Beta 4 this now doesn't work anymore and the window opens in a 16:9 format and then will scale down to the .defaultSize of the WindowGroup with an animation. Settings, Notes, Safari still open with a different default size though, including the launch screen. How are we supposed to do this now?
2
1
1.2k
Jul ’25
Observing RealityKit Components?
So I can observe RealityKit Components by using the new @Observable or using ObservableObject, both of these require my Component to be a class instead of a struct though. I've read that making a Component a class is a bad idea, is this correct? Is there any other way to observe values of an entities' components?
2
0
815
Oct ’23
Binding to a value of a Component of Entity?
I have a HealthComponent and a HealthSystem which decreases the health value for all Entities with the HealthComponent every 2 seconds in the update loop of the system. Now if, in a SwiftUI view, I want to show the current health value and bind to it, how would I do this? Ive tried adding the entity to my Character struct bit that obviously doesn’t update by itself.
2
0
973
Jul ’23
Alert within Popover is clipped in height causing title to be hidden
When showing an Alert from within a Popover that has a fixed height, the newly presented Alert is in the same position but gets limited by the Popovers height causing the title of the Alert to be hidden. Is this intentional behavior or are Alerts not supported within Popovers and I'd have to pass it through to my main view? Code: // // DemoalertPopover.swift // ******** // // Created by Thilo on 26.06.2023. // import SwiftUI struct DemoAlertPopover: View { @Environment(\.dismiss) var dismiss @State private var showDeleteConfirmation = false let dateFormatter: DateFormatter = { let formatter = DateFormatter() formatter.dateFormat = "dd.MM.yyyy" return formatter }() var body: some View { VStack(alignment: .leading, spacing: 0) { HStack { Text("Title").font(.extraLargeTitle).lineLimit(1) Spacer() Button(action: { dismiss() }) { Label("Close", systemImage: "xmark").labelStyle(.iconOnly) } } HStack(alignment: .center) { Text("Content").font(.largeTitle) Text("Content2").foregroundStyle(.secondary) } LazyVGrid(columns: [GridItem(.flexible(), spacing: 10),GridItem(.flexible(), spacing: 10),], spacing: 10) { Button(action: { showDeleteConfirmation = true }) { ZStack{ Image(systemName: "trash.fill").resizable().foregroundColor(.primary) }.aspectRatio(1/1,contentMode: .fit) .frame(maxWidth: .infinity).padding(5) }.aspectRatio(3/1,contentMode: .fit) }.alert("Are you sure you want to delete ...?", isPresented: $showDeleteConfirmation) { Button("Trash",role: .destructive, action: { print("Deleted") dismiss() }) Button("Cancel", role: .cancel) {} } message: { Text("This is a small message below the title, just so you know.") } } .padding(.all, 10).frame(width: 300) } } #Preview { DemoAlertPopover() } Video: https://www.youtube.com/shorts/31Kl7qbJIiA
Replies
2
Boosts
0
Views
858
Activity
Oct ’25
visionOS Window launch size
Before visionOS Beta 4 it was possible to define the launch size in the Info.plist using PreferredLaunchSize like so: <key>UILaunchPlacementParameters</key> <dict> <key>PreferredLaunchSize</key> <dict> <key>Height</key> <integer>750</integer> <key>Width</key> <integer>750</integer> </dict> </dict> In visionOS Beta 4 this now doesn't work anymore and the window opens in a 16:9 format and then will scale down to the .defaultSize of the WindowGroup with an animation. Settings, Notes, Safari still open with a different default size though, including the launch screen. How are we supposed to do this now?
Replies
2
Boosts
1
Views
1.2k
Activity
Jul ’25
SwiftData on visionOS?
As of now, it's not listed as supported and also doesn't work. Is SwiftData not coming to visionOS?
Replies
3
Boosts
0
Views
1k
Activity
Nov ’23
Observing RealityKit Components?
So I can observe RealityKit Components by using the new @Observable or using ObservableObject, both of these require my Component to be a class instead of a struct though. I've read that making a Component a class is a bad idea, is this correct? Is there any other way to observe values of an entities' components?
Replies
2
Boosts
0
Views
815
Activity
Oct ’23
RealityView Ambiguous use of... in Beta 8 of Xcode
Using Xcode 15 Beta 8 and RealityView with make, update, placeholder and attachments I get the error message "Ambiguous use of 'init(make:update:placeholder:attachments:)'" which didn't occur in Beta 7 and visionOS Beta 2. The most basic version (just make) of RealityView works perfectly fine. Is there a workaround for this?
Replies
1
Boosts
1
Views
1.5k
Activity
Aug ’23
Model3D content clips through Modal
How can I change the offset of a Modal to not make Model3D's which are in the backgrounding view clip through the modal?
Replies
1
Boosts
1
Views
573
Activity
Aug ’23
Xcode 15 Beta 5 breaks existing RealityKitContentBundle
When using Xcode 15 Beta 5, a project created with Xcode 15 Beta 3 seemingly fails to open any scene within the RealityKitContentBundle anymore while a newly created one works flawlessly. How can I reregister my bundle?
Replies
8
Boosts
1
Views
1.8k
Activity
Aug ’23
Binding to a value of a Component of Entity?
I have a HealthComponent and a HealthSystem which decreases the health value for all Entities with the HealthComponent every 2 seconds in the update loop of the system. Now if, in a SwiftUI view, I want to show the current health value and bind to it, how would I do this? Ive tried adding the entity to my Character struct bit that obviously doesn’t update by itself.
Replies
2
Boosts
0
Views
973
Activity
Jul ’23
Pathfinding in RealityKit/on visionOS
Is there any implementation for a CharacterControllerComponent of Path finding for RealityKit/for visionOS like there was e.g. on SceneKit using GameplayKit?
Replies
1
Boosts
0
Views
716
Activity
Jun ’23