Post

Replies

Boosts

Views

Activity

Ignore accented rendering mode?
In iOS18 the user can change their Home Screen customization to choose either light, dark, or tinted. If they choose tinted the widgets are rendered using the "accented" rendering mode and without a background. Is there some way to override so that the tinted mode is ignore completely and the widgets render as full color? I know about WidgetAccentedRenderingMode (https://developer.apple.com/documentation/widgetkit/widgetaccentedrenderingmode) but that's only for images, not the whole control and doesn't help with the background also being removed in the tinted mode.
2
0
459
Aug ’24
colorScheme value always dark after setting dark mode in display and brightness even if Home Screen customization is light
If you set the display and brightness settings in iOS to be in dark mode, then the value returned in the colorScheme environment value: https://developer.apple.com/documentation/swiftui/environmentvalues/colorscheme @Environment(.colorScheme) var colorScheme is always dark, even if you toggle between light or dark in the Home Screen customization option. Tinted is reported correctly. Is there some way to get the Home Screen customization light/dark/tinted value correctly? Swapping the Home Screen customization value between light/dark does swap between the light and dark app icon so it seems like the widget color scheme should also swap in this case.
2
0
300
Sep ’24
Crash on iOS18 Beta5 when adding a SCNAnimation animationDidStop closure with Swift6 selected
I'm trying to update my projects to use Swift6, if I change the project settings to use Swift6 then my app crashes when I add a closure to the SCNAnimation animationDidStop property. The error is inside the SceneKit renderingQueue and indicates that the callback is being called on the wring queue. Maybe I need to do something in the code to fix this but I can't seem to make it work, maybe a SceneKit bug? If you create a new game template in Xcode using SceneKit and replace the contents of GameViewController.swift with the following you will see the app crash after it is launched. import UIKit import SceneKit class GameViewController: UIViewController { let player: SCNAnimationPlayer = { let a = CABasicAnimation(keyPath: "opacity") return SCNAnimationPlayer(animation: SCNAnimation(caAnimation: a)) }() override func viewDidLoad() { super.viewDidLoad() let scnView = self.view as! SCNView scnView.scene = SCNScene() // Change the project settings to use Swift6 // Setting this closure will then cause a _dispatch_assert_queue_fail // EXC_BREAKPOINT error in the scenekit.renderingQueue.SCNView queue, // the only thing on the stack is: // "%sBlock was %sexpected to execute on queue [%s (%p)]" player.animation.animationDidStop = { (a: SCNAnimation, b: SCNAnimatable, c: Bool) in print("stopped") } scnView.scene?.rootNode.addAnimationPlayer(player, forKey: nil) player.play() } }
2
2
495
Aug ’24
App Icon all black on ios17, works on iOS18, building app in Xcode16 beta
In my app I added an AppIcon in the Assets.xcassets folder. I added a any/dark/tinted version of the app icon, in 1024x1024 resolution as a HEIC file, specifying a "single size" iOS option. When I build and run the app in xcode16 beta on iOS18 the icon works as expected, but when I run the same app on iOS17 the icon just shows up as a black rectangle. How do I get the app icon to work correctly on both iOS18 and iOS17?
1
0
507
Aug ’24
Elapsed scene time used in custom shader uniform
If you create a custom shader you get access to a collection of uniform values, one is the uniforms::time() parameter which is defined as "the number of seconds that have elapsed since RealityKit began rendering the current scene" in this doc: https://developer.apple.com/metal/Metal-RealityKit-APIs.pdf Is there some way to get this value from Swift code? I want to animate a value in my shader based on the time so I need to get the starting time value so I can interpolate the animation offset from that point. If I create a System in the update() function I get a SceneUpdateContext instance and that has a deltaTime property but not an elapsedTime property which I would assume would map to the shader time() value.
1
0
596
Jun ’24
How to reduce draw call count in RealityKit
I'm trying to render a large number of entities, it looks like each ModelEntity causes a draw call, even if you share the ModelComponent so each Entity shares the mesh and materials. I tried to use the MeshInstanceCollection inside MeshResource to generate a large number of objects in the scene, the code works and draws many objects but the draw count is still one call per instance, this seems strange I would assume it should only be one draw call for the single entity since I have specified to use instancing in the resource. Has anybody else successfully used instancing in RealityKit to draw a large number go Entities (maybe around 10,000) or drawn this amount of items successfully with 60fps any other way? Here is some sample code that draws 100 cubes using instancing but still causes 100 draw calls. func instanceTest(scene: RealityKit.Scene) { var resource = MeshResource.generateBox(size: 0.2) var contents = MeshResource.Contents() contents.models = resource.contents.models var arr: [MeshResource.Instance] = [] var matrix = matrix_identity_float4x4 matrix[3, 0] = 0.5 for i in 0..<100 { let inst = MeshResource.Instance(id: "\(i)", model: "MeshModel", at: matrix) arr.append(inst) } contents.instances = MeshInstanceCollection(arr) let updatedResource = try? MeshResource.generate(from: contents) let unlitMaterial = UnlitMaterial(color: .red) let modelEntity = ModelEntity( mesh: updatedResource!, materials: [unlitMaterial] ) let anchor = AnchorEntity() anchor.addChild(modelEntity) scene.addAnchor(anchor) }
2
1
676
Jun ’24
Blank widgets after app updates on iOS17
After updating our app some of our users are seeing that their widget has gone blank, the whole widget it just white. The only way to make the widget render again is to reboot the phone. This seems to be happening randomly and mainly on iOS17. Looking on the web, seems like other people are also having this issue so hopefully Apple will make a fix at some point but I'm wondering if other people have had this issue and figured out a workaround to stop it happening? Thanks.
4
9
7.8k
Dec ’23
String(localized:locale) ignores locale parameter
I'm trying to load a localized string with a specific Locale, for example: String(localized: "someKey", locale: Locale(identifier: "fr")) However the locale I pass in is being ignored, no matter what I set it to the string returns a value using the Locale.current value not the parameter I pass in. Am I doing something wrong, is there some way to specify a certain locale?
1
0
516
Jan ’24
getTimeline called twice on load
When I run my widget from xcode I see getTimeline is called twice for some reason. It's called the first time, then after it returns a timeline it's called again. The logs have the following message: "-[EXSwiftUI_Subsystem beginUsing:withBundle:] unexpectedly called multiple times." It takes about 0.5 seconds for the first getTimeline call to return so it doesn't seem like the OS should try to call this method again so quickly (my timeline entries all have times in the future so they shouldn't request the widget to load immediately) Is this a bug, or expected? Seems to happen every time I run the widget.
8
2
3.7k
Sep ’20
Information on AudioPlaybackIntent
Is there any information on what the AudioPlaybackIntent does? The documentation doesn't give any information on it: https://developer.apple.com/documentation/appintents/audioplaybackintent I have an audio app and I want to add a play/pause button to our widget for iOS17, I'm assuming I need to use an AudioPlaybackIntent but there is no documentation on what it does. Thanks.
0
0
680
Sep ’23
Blank scene with xcode connected and "Metal -> API Validation" turned off.
I'm not sure which combination of iOS/XCode/Mac OS is causing this issue, but all of a sudden when I try to run our SceneKit app and the "Scheme -> Diagnostics -> Metal -> API Validation" setting is turned off the scene won't render and the console is just full of the following errors: Execution of the command buffer was aborted due to an error during execution. Invalid Resource (00000009:kIOGPUCommandBufferCallbackErrorInvalidResource) [SceneKit] Error: Main command buffer execution failed with status 5, error: Error Domain=MTLCommandBufferErrorDomain Code=9 "Invalid Resource (00000009:kIOGPUCommandBufferCallbackErrorInvalidResource)"  ) If you run the app outside of xcode it's fine, also enabling the "API Validation" option stops the issue. One of my schemes has this option disabled since the project began and never had an issue before. Just throwing this out there incase someone else has spent hours of their life trying to figure out why this is not working for them. Also you can just create a new SceneKit project and turn that diagnostic option off and the app won't render anything.
2
0
1.7k
Apr ’22