Ever since Xcode updated yesterday I continually get the following warning message coming up on the console, with each consecutive - and identical - message highlighted in yellow & then red. The message reads:
"CoreUI: _Bool CUIValidateIdiomSubtypes(NSInteger, NSUInteger *) passed a device subtype '2752' and idiom '2':pad that are not a matching pair, subtype is not valid with given idiom. Assuming subtype should be 0 instead."
The program still runs but it's rather annoying, plus I'd like to know the cause.
Xcode: 15.4 / iOS (in Xcode) 17.5
Any ideas?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I posted this question on stack overflow the other day but haven't received any replies as yet. I want to be able to access SpriteKit node characteristics on a background thread. I only require a copy of these characteristics but don't know how to do this. The full question was:
I’m working on my first Swift project. It uses SpriteKit and has quite a few vehicles moving around different tracks. Each vehicle must be aware of other vehicles to avoid collisions and for overtaking etc. The processing for this is very time consuming so I want to run most of the calculations concurrently on a number of background threads.
To do this, I copied the vehicles defined in the arrays track1Vehicles and track2Vehicles (arrays of SKSpriteNodes) to t1Vehicle and t2Vehicle. The idea was to perform all the calculations on these, then afterwards transfer the new positions etc back to the original arrays using SKActions on the main thread. The problem I’m having is that any reference to t1Vehicle and t2Vehicle parameters gives the error “Main actor-isolated property 'goalSpeed' can not be mutated from a non-isolated context” (goalSpeed being one of those parameters). Is there a way to allow t1Vehicle and t2Vehicle on a background thread, perhaps by disabling their physicsBodies or similar?
t1Vehicle & t2Vehicle are not intended to themselves alter the display. They are intended only as a means of accessing the data as it was when the ‘findObstacles’ function was called. If there’s another way to reference this data, that would also solve the problem.
The relevant parts of the code are shown below:
//this code is on the main thread
Task {
let result = await findObstacles()
let t1Vehicle = result.t1Vehicle
let t2Vehicle = result.t2Vehicle
}
//Function called from the Task above
func findObstacles() async -> (t1Vehicle: Vehicle, t2Vehicle: Vehicle) {
//Create copy of vehicles for calculating proximity to other vehicles
//Do calculations on another thread
var t1Vehicle = track1Vehicles.dropFirst() //Straight Track Vehicles: Ignore element [0]
t1Vehicle.sort(by: {$0.position.y < $1.position.y}) //Sort into positional order, 000 - 999.999
var t2Vehicle = track2Vehicles.dropFirst()
t2Vehicle.sort(by: {$0.position.y < $1.position.y}) //Sort into positional order, 000 - 999.999
//processing of data here..
return (t1Vehicle, t2Vehicle)
}
ps. the 'Vehicle' type is an ObservableObject. A number of its parameters were also Published variables. I tried removing the '@Published' from the parameter 'goalSpeed' and it made no difference - the error still occurred on it.
I'm getting the impression that nodes can only be accessed from the main thread. With my code I am copying 2 arrays of nodes and use those copies in the background thread/s. The original arrays are not altered. They could even be copied prior to going into the background thread. I need access to things such as position and velocity for each node and there can potentially be 300 of them. A fast & simple way to copy these parameters from all nodes into a normal array would do. Currently my copy still contains nodes even though I don't display them and only require read access.
Is there a way to read how much minimumScaleFactor has changed a font size by? I suspect there's not but it would be a very handy addition to SwiftUI.
My problem is that I have a number of text boxes linked together with VStacks and HStacks all in a larger view. Using minimumScaleFactor I can rescale text to fit the alloted size however once this size is found I need some of the other text boxes to adopt the same size font and line spacing. There is only one box I need to completely fill - the others should be the same font size so they line up and I don't have a mish-mash of different sizes.
If I were able to read the scaling used to fit text into the first box I could then use this number to calculate and set the size of the fonts elsewhere.
Perhaps there's a better method?
I want to programmatically determine the height of the safe area of the screen in pixels and save this value as a constant (in much the same way as "UIScreen.main.nativeBounds.height" returns the full height of the screen in pixels). I've done searches for this but most answers I found use deprecated instructions and don't work. I'm using SwiftUI. I also tried GeometryReader without success. Using ".offset(y: geometry.size.height)" with GeometryReader moved the image however replacing that line with "let scrnHeight = geometry.size.height" produced a compile error back on the GeometryReader definition line. Various tweaks to the line defining the constant gave the same result. I don't want to move or change the image, I just want the height value. The reason I want this constant is for scaling various images, placing them at the correct point on the screen and for defining their speed around the screen. I have an image which is imported to fit the height of the screen safe area in the background. The height of this equates to 400 metres - therefore the pixel height for any iPhone or iPad will be (400m/(height of safe area in pixels)). The system clearly knows this figure as the imported image fits the safe area precisely using ".aspectRatio(contentMode: .fill). I simply need to access the value. Any help would be appreciated - thanks!