Post

Replies

Boosts

Views

Activity

Putting buttons over SwiftUI map view
Has anyone gotten custom buttons to work on top of tvOS Map()? I've tried many variations of FocusState focusSection .defaultFocus() and as soon as the map appears at startup the buttons never get focus again. They are on a ZStack over the map. I could post code but truthfully nothing works for me. I'm wondering if anyone has successfully put focusable buttons on top of the map view.
0
0
182
Mar ’25
Why is the pitch slider visible in SwiftUI tvOS map view?
Why is the pitch slider always visible in the SwiftUI tvOS map view? It doesn't even appear to be supported there, let alone the fact that I specify mapControlVisibility(.hidden). Am I missing something or is Apple? See attached screenshot. This really messes up my UI. Here is my code: import SwiftUI import MapKit struct ContentView: View { @State var position = MapCameraPosition.region(MKCoordinateRegion( center: CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194), span: MKCoordinateSpan(latitudeDelta: 0.05, longitudeDelta: 0.05))) var body: some View { Map(position: $position) .mapControlVisibility(.hidden) .mapStyle(.standard(pointsOfInterest: .including(.airport))) } }
0
0
200
Mar ’25
WeatherKit forecast dates - what are they?
I don’t understand what the times are that are returned in forecasts. guard let (current, hourly, daily) = try? await weatherService.weather(for: location, including: .current, .hourly, .daily(startDate: startDate, endDate: endDate)) I’m expecting this to be the time to which the forecast applies. let utc = hourly.forecast[hour].date When I convert it from UTC to local time I get something unusual for localDate let dateFormatter = DateFormatter() dateFormatter.timeZone = TimeZone.current dateFormatter.dateFormat = "ha" let localDateString = dateFormatter.string(from: utc) What are these times? Shouldn’t the hourly be times increasing in one hour increments from startDate? Am I doing something incorrectly? Thanks
7
1
2.6k
Aug ’22
RoomPlan doesn't link
I'm suddenly getting link errors on the RoomPlan framework. Even the Apple sample code is not building. I'm on 13.0 Beta (22A5311f) with Xcode Version 14.0 beta 3 (14A5270f) on a Mac Studio. Is anyone else seeing this? dyld[1232]: Symbol not found: _$s8RoomPlan08CapturedA0V6export2toy10Foundation3URLV_tKF   Referenced from: <24F0F645-03CF-3834-BB80-F51E9CAEC10D> /private/var/containers/Bundle/Application/041C1232-EE67-42F3-AE47-F351FE81CE9A/RoomPlanExampleApp.app/RoomPlanExampleApp   Expected in:     <FFA44726-2CCB-3BE3-ABDE-26B7F6214D68> /System/Library/Frameworks/RoomPlan.framework/RoomPlan Symbol not found: _$s8RoomPlan08CapturedA0V6export2toy10Foundation3URLV_tKF   Referenced from: <24F0F645-03CF-3834-BB80-F51E9CAEC10D> /private/var/containers/Bundle/Application/041C1232-EE67-42F3-AE47-F351FE81CE9A/RoomPlanExampleApp.app/RoomPlanExampleApp   Expected in:     <FFA44726-2CCB-3BE3-ABDE-26B7F6214D68> /System/Library/Frameworks/RoomPlan.framework/RoomPlan dyld config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/usr/lib/libBacktraceRecording.dylib:/usr/lib/libMainThreadChecker.dylib:/usr/lib/libRPAC.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
2
1
1.1k
Aug ’22
RoomCapture instruction view?
The RoomCaptureView seems to have a coaching controller analogous to the ARCoachingOverlayView. The content is available via public func captureSession(_ session: RoomCaptureSession, didProvide instruction: RoomCaptureSession.Instruction) Is the view that presents these instructions available if not using the RoomCaptureView?
0
0
1.2k
Jun ’22
RoomCapture Visualizer
In the WWDC video the code includes a reference to the visualizer object. var previewVisualizer: Visualizer! I'd like to create my own ViewController using RoomCaptureSession and incorporate the visualizer. This doesn't seem to be available in the RoomPlan framework, have I missed something or has this been removed from the public interface? Thanks
2
0
1.4k
Jun ’22
Exporting from Roomplan when using
When using the RoomPlan UI (RoomCaptureView), one obtains the final result using  public func captureView(didPresent processedResult: CapturedRoom, error: Error?) which then gets exported via finalResults.export(to: url) What is the best way to do this if only using RoomCaptureSession? Should I just keep track if each CapturedRoom coming back in the delegate methods and use the final one?
1
0
1.5k
Jun ’22
Creating Entity Component System
I’m implementing my first Component Entity System and am having an issue. I have a requirement that some component properties be dynamic. I do not want to create a subclass that conforms to HasExampleComponent, so this was my approach. My issue is that even though the entity contains the property I can’t cast it to HasExampleComponent. When I create the entity I set the component like this: entity.components[ExampleComponent.self] = .init() I'd appreciate a template for a ECS with component properties that can be updated from the app. Thanks public struct ExampleComponent: Component {     public var value = 0 } public protocol HasExampleComponent: Entity { var value: Int } public class ExampleSystem: System {     private static let query = EntityQuery(where: .has(ExampleComponent.self))     public required init(scene: Scene) {}       public func update(context: SceneUpdateContext) {         context.scene.performQuery(Self.query).forEach { entity in // this won’t work because entity doesn’t conform to HasExampleComponent             entity.value += 1         }     } } extension Entity {     @available (iOS 15.0, *)     public var value: Int? {         get { components[RotatingComponent.self].value ?? 0}         set { components[RotatingComponent.self].value = newValue }     } }
0
0
693
Jun ’22
Entity dimensions in RealityKit
I’m loading a USDZ model using Entity.loadAsync(contentsOf:) I’d like to get the dimensions of the model and I find that visualBounds(relativeTo: nil).extents returns dimensions larger than the actual dimensions while I see the correct dimensions when viewing the USDZ in Blender or when instantiating it as a MDLAsset(url:). What is the method to get the actual dimensions from an Entity? Thanks Thanks
2
0
1.5k
May ’22
Get coordinates of pivot point in ModelEntity
I'd like to know the location of the pivot point of a ModelEntity, is there any way to get this? Alternatively can I get it from a USDZ file? I want to place models in a specific location and some models have the pivot in the center while others have it at the bottom. If I can detect this I can adjust accordingly and place them correctly. I don't have control over the models, alas. Thanks, Spiff
3
0
1.8k
Apr ’22
Move entity to center of nonAR view
I'm recreating the ARQuickLook controller in code. One of its behaviors is to move the model to the visible center when entering Obj mode. I've hacked the ARViewContainer of the default Xcode Augmented Reality App to demonstrate what I'm trying to do. I think that moving the entity to 0,0,0 will generally not do the right thing because the world origin will be elsewhere. What I'm not clear on is how to specify the translation for entity.move() in the code. I'm assuming I'll need to raycast using a CGPoint describing view center to obtain the appropriate translation but I'm not sure about the details. Thanks for any help with this. struct ARViewContainer: UIViewRepresentable { let arView = ARView(frame: .zero) let boxAnchor = try! Experience.loadBox() func makeUIView(context: Context) -> ARView { arView.scene.anchors.append(boxAnchor) return arView } func updateUIView(_ uiView: ARView, context: Context) { DispatchQueue.main.asyncAfter(deadline: .now() + 4) { arView.environment.background = .color(.white) arView.cameraMode = .nonAR if let entity = boxAnchor.children.first { let translation = SIMD3<Float>(x: 0, y: 0, z: 0 ) let transform = Transform(scale: .one, rotation: simd_quatf(), translation: translation) entity.move(to: transform, relativeTo: nil, duration: 2, timingFunction: .easeInOut) } } } }
5
0
1.9k
Mar ’22
Can ARView switch between camera and non-camera mode?
AR Quick Look has two modes: Object Mode: one can view a model in an empty space with a ground plane and a shadow AR Mode: one can view the model in an SR context, within a real environment Does the developer have access to this functionality (moving between camera and non-camera modes)? I'm really asking if the camera can be disabled and reenabled in the same session. Thanks
3
0
1.7k
Mar ’22