Skip to content

Instantly share code, notes, and snippets.

View elkraneo's full-sized avatar

Cristian Díaz elkraneo

View GitHub Profile

Transform order issues in the Reality Composer Pro inspector

FB16078162

When tweaking values in RCP's transform inspector, particularly those associated with rotation in world space, the behavior is unreliable. Some extra logic seems to be happening to avoid incorrect transforms; however, the results do not always appear correct. For example, in the attached video, while adjusting X and Y, the inspector automatically populates the Z rotation, making even restoring the original transform difficult. https://youtu.be/rA2Sp9xd4Ko

Async loading equipment

FB16078151

The requirements for game equipment loading during setup, which we were unable to find any prior references for, took us off guard as I tried to control the loading flow. Using await "Entity(named" instead of the synchronous version leads to a silent failure that doesn't display the equipment ultimately. We found a reference on the forums involving using placeholder entities and recalculating the bounding box, but I'm not sure if this is the correct technique to asynchronously load entity equipment and feed it back into the system.

if let focusGreenEntity = try? await Entity(named: BundleAssets.focusGreenEntity, in: realityKitContentBundle) {
  if let equipment = game?.setup.colorEquipment.first(where: { $0.id == .FocusBlend.greenID }) {
    equipment.entity.addChild(focusGreenEntity)
    let bbox = focusGreenEntity.visualBounds(relativeTo: equipment.entity)
 game?.tabletopGame.addAction(.updateEquipment(equipment, boundingBox: Rect3D(bbox)))
Name Category
Camera Capture
Magnifier Capture
Scan Code Capture
Alarm Clock
Stopwatch Clock
Timer Clock
Airplane Mode Connectivity
Bluetooth Connectivity
Cellular Data Connectivity
import CoreLocation
import RealityKit
import RealityKitContent
import SwiftUI
struct ImmersiveView: View {
var body: some View {
RealityView { content in
if let earthEntity = try? await Entity(named: "Earth", in: realityKitContentBundle) {
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 4 columns, instead of 3 in line 7.
Event Transcript Name Link
WWDC24
WWDC24 18 things from WWDC24 https://devimages-cdn.apple.com/wwdc-services/transcripts/individual/wwdc2024/wwdc2024-111976/eng_bdd89e7893f9/wwdc2024-111976-transcript-eng.json
WWDC24 Bring context to today’s weather https://devimages-cdn.apple.com/wwdc-services/transcripts/individual/wwdc2024/wwdc2024-10067/eng_8d6b40e9336d/wwdc2024-10067-transcript-eng.json
WWDC24 Bring your Live Activity to Apple Watch https://devimages-cdn.apple.com/wwdc-services/transcripts/individual/wwdc2024/wwdc2024-10068/eng_cb5b3cef853d/wwdc2024-10068-transcript-eng.json
WWDC24 Bring your app to Siri https://devimages-cdn.apple.com/wwdc-services/transcripts/individual/wwdc2024/wwdc2024-10133/eng_6bfa0ce95261/wwdc2024-10133-transcript-eng.json
WWDC24 Bring your app’s core features to users with App Intents https://devimages-cdn.apple.com/wwdc-services/transcripts/individual/wwdc2024/wwdc2024-10210/eng_4243621a1edc/wwdc2024-10210-transcript-eng.json
WWDC24 Bring your machine learning and AI m
Name Topics Referenced In URL
Accessibility updates Accessibility & Inclusion wwdc2024-10073, wwdc2023-10036 https://developer.apple.com/documentation/Updates/Accessibility
Human Interface Guidelines: Accessibility Accessibility & Inclusion wwdc2024-10074, wwdc2019-802 https://developer.apple.com/design/human-interface-guidelines/accessibility
Human Interface Guidelines: Typography Accessibility & Inclusion wwdc2024-10074, wwdc2020-10175 https://developer.apple.com/design/human-interface-guidelines/typography
Performing accessibility testing for your app Accessibility & Inclusion wwdc2024-10073 https://developer.apple.com/documentation/Accessibility/performing-accessibility-testing-for-your-app
UILargeContentViewerInteraction Accessibility & Inclusion wwdc2024-10074 https://developer.apple.com/documentation/uikit/uilargecontentviewerinteraction
accessibilityShowsLargeContentViewer() Accessibility & Inclusion wwdc2024-10074 https://developer.apple.com/documentation/SwiftUI/View/accessibilityShowsLargeContentVi
Name Topics Referenced In URL
Enhancing the accessibility of your SwiftUI app Accessibility & Inclusion 10073, 10074 https://developer.apple.com/documentation/Accessibility/enhancing-the-accessibility-of-your-swiftui-app
Accelerating app interactions with App Intents App Services 10210, 10176, 10134 https://developer.apple.com/documentation/AppIntents/AcceleratingAppInteractionsWithAppIntents
Accessing a person’s contact data using Contacts and ContactsUI App Services 10121 https://developer.apple.com/documentation/Contacts/accessing-a-person-s-contact-data-using-contacts-and-contactsui
Adopting SwiftData for a Core Data app App Services 10137 https://developer.apple.com/documentation/coredata/adopting_swiftdata_for_a_core_data_app
Configuring the PencilKit tool picker App Services 10214 https://developer.apple.com/documentation/pencilkit/configuring_the_pencilkit_tool_picker
Connecting to a service with passkeys App Services 10125 https://developer.apple.com/documentation/authenticationservices/connecting_to
extension Measurement where UnitType == UnitTemperature {
var color: Color {
/// Convert input temperature to Celsius for consistency
let temperatureInCelsius = self.converted(to: .celsius)
/// Find the two closest color values in Celsius
var lowerIndex = 0
var upperIndex = 0
for i in 0..<colorSteps.count {
struct ContentView: View {
let temperature = Measurement<UnitTemperature>(value: 13, unit: .celsius)
var body: some View {
List {
Text("let temperature = Measurement<UnitTemperature>(value: 13, unit: .celsius)")
.font(.headline)
Section("Implicit formatting") {
LabeledContent("temperature.formatted()", value: temperature.formatted())

AccessibilityComponent custom rotors breaks VoiceOver

FB13769967

When you try to listen to a custom rotor navigation event inside an AccessibilityComponent, the RealityRender stops working as it would normally. It looks like the .customRotors collection property is emptied, but there are no signs of Entity reconstruction. The focus is also lost, and other entities with custom rotors are reset too. After running the custom rotor on the video, it was impossible to get back to focus, and VoiceOver acted anxious.