Post

Replies

Boosts

Views

Activity

Reply to Horizontal window/map on visionOS
Hi, for anyone looking for similar thing, this solution worked nice for me: import SwiftUI import RealityKit import MapKit struct SwiftUIView: View { @PhysicalMetric(from: .meters) private var oneMeter = 1 @State var mainEntity = Entity() var body: some View { RealityView { content, attachments in // Create and configure the 3D shape entity let shapeEntity = ModelEntity(mesh: .generateCylinder(height: 0.03, radius: 0.45)) mainEntity.addChild(shapeEntity) content.add(shapeEntity) mainEntity.addChild(shapeEntity) if let mapAttachment = attachments.entity(for: "mapAttachment") { // Adjust the map attachment's transformation to the same size and orientation as the 3D shape entity mapAttachment.transform = Transform(pitch: -.pi / 2, yaw: 0, roll: 0) // Position the map slightly above the 3D shape entity let shapeDimensions = shapeEntity.visualBounds(relativeTo: nil).extents mapAttachment.setPosition(SIMD3<Float>(0, shapeDimensions.y / 2 + 0.0001, 0), relativeTo: shapeEntity) mainEntity.addChild(mapAttachment) } content.add(mainEntity) } attachments: { // Create and add a map attachment to the RealityKit scene Attachment(id: "mapAttachment") { Map() .frame(width: oneMeter * 0.45 * 2, height: oneMeter * 0.45 * 2) .mask(Circle()) } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’24
Reply to TipKit: showing a popover tip on a SwiftUI toolbar button
I am still unable to make this work under iOS 26 using the combination with .tipBackgroundInteraction(.enabled). Without this modifier, it could be solved by adding popoverTip to the label or adding button style. But this new interaction modifier breaks it completely. Have you found any solution to this? ToolbarItem { Button { print("taptap") } label: { Text("Here") } .buttonStyle(.plain) .popoverTip(myTip, arrowEdge: .top) .tipBackgroundInteraction(.enabled) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
2w
Reply to Horizontal window/map on visionOS
Hi, for anyone looking for similar thing, this solution worked nice for me: import SwiftUI import RealityKit import MapKit struct SwiftUIView: View { @PhysicalMetric(from: .meters) private var oneMeter = 1 @State var mainEntity = Entity() var body: some View { RealityView { content, attachments in // Create and configure the 3D shape entity let shapeEntity = ModelEntity(mesh: .generateCylinder(height: 0.03, radius: 0.45)) mainEntity.addChild(shapeEntity) content.add(shapeEntity) mainEntity.addChild(shapeEntity) if let mapAttachment = attachments.entity(for: "mapAttachment") { // Adjust the map attachment's transformation to the same size and orientation as the 3D shape entity mapAttachment.transform = Transform(pitch: -.pi / 2, yaw: 0, roll: 0) // Position the map slightly above the 3D shape entity let shapeDimensions = shapeEntity.visualBounds(relativeTo: nil).extents mapAttachment.setPosition(SIMD3<Float>(0, shapeDimensions.y / 2 + 0.0001, 0), relativeTo: shapeEntity) mainEntity.addChild(mapAttachment) } content.add(mainEntity) } attachments: { // Create and add a map attachment to the RealityKit scene Attachment(id: "mapAttachment") { Map() .frame(width: oneMeter * 0.45 * 2, height: oneMeter * 0.45 * 2) .mask(Circle()) } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to TipKit: showing a popover tip on a SwiftUI toolbar button
I am still unable to make this work under iOS 26 using the combination with .tipBackgroundInteraction(.enabled). Without this modifier, it could be solved by adding popoverTip to the label or adding button style. But this new interaction modifier breaks it completely. Have you found any solution to this? ToolbarItem { Button { print("taptap") } label: { Text("Here") } .buttonStyle(.plain) .popoverTip(myTip, arrowEdge: .top) .tipBackgroundInteraction(.enabled) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
2w