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
Post
Replies
Boosts
Views
Activity
Is there any implementation for a CharacterControllerComponent of Path finding for RealityKit/for visionOS like there was e.g. on SceneKit using GameplayKit?
As of now, it's not listed as supported and also doesn't work.
Is SwiftData not coming to visionOS?
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.
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?
How can I change the offset of a Modal to not make Model3D's which are in the backgrounding view clip through the modal?
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?
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?
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?