@OOPer, thx for sharing your code.
@JL, in a one-to-one port of Apple‘s ray tracer sample (Accelerating ray tracing using Metal) one would use the transpose of the matrix because the sample uses row-first order and MTLAccelerationStructureInstanceDescriptor.transformationMatrix expects column-first.
anInstanceDescriptorPointer.pointee.transformationMatrix = MTLPackedFloat4x3(aNodeInstance.transform.transpose)
Without transpose the render result seems to be a single Cornell Box but in fact are nine instances stacked at the same position.
A bit late, but in case anyone else will come across…
Post
Replies
Boosts
Views
Activity
When adding resources using the menu item Insert from..., SP4 puts them into a Recources folder. If it does not exist SP4 creates that folder and adds an entry to Package.swift to process these resources when it builds the app. The entry is .process("Resources").
In my former 5.5 app I put Settings.bundle into the Resources folder and it worked as expected, that is the settings appeared in the Settings App. But in a newer version of SP4, the one with Swift 5.6 support, things seem to have changed. Settings.bundle has to be placed in the top-level folder of the app (as a folder-sibbling of Resources) and Package.swift needs one more entry:
.process("Resources"),
.copy("Settings.bundle")
Thx for pointing me to the Swift on Windows forum. For now, you gave the answer to my question: anti-pattern. I'll change the design of my app to use structured concurrency as you suggested. That's easy to do and conforms to Swift concurrency.
Your reply makes perfect sense, but (as there is always a but) the six print statements in my example were actually supposed to give the task time to complete (and on my Winos box they do). If I substitute them with an infinite loop the behavior is the same: the task execs with main defined in extension Dummy and does not exec with main in struct Dummy. That infinite loop thing is quite close to the logic of my app which first starts an independent background task to create files and then loops forever processing these files as they occur.
Task execs:
struct Dummy {}
@main
extension Dummy {
static func main() {
_ = Task { print("in task in main") }
var c = 0
while true {
c += 1
}
}
}
Task not exec'ing:
@main
struct Dummy {
static func main() {
_ = Task { print("in task in main") }
var c = 0
while true {
c += 1
}
}
}
Inspired by your examples I found adding a rather short Task.sleep makes my task work with main defined in struct Dummy:
@main
struct Dummy {
static func main() async {
_ = Task { print("in task in main") }
try? await Task.sleep(nanoseconds: 1)
var c = 0
while true {
c += 1
}
}
}
It's somewhat academic but I really would like to know, well why...
Putting my app to TestFlight shows performance as expected. It thus seems to be true that SP4 uses debug configuration. I also came across _isDebugAssertConfiguration() on Stack Overflow (#24003291) which evaluates to true in SP4 and false in TestFlight. Regards, J.
this post on stackoverflow might help. adding @nonobjc dynamic at least makes the error disappear. @objc(newNameMethod:) could be an option, too.
I had the same question and found the following hack for those without access to Xcode (which would allow attaching icons to playgrounds, I assume). Here is how I did it after some investigation in one of the sample playgrounds:
Close playground in question in SP4
Find playground folder on iCloud
CD into and further down into Contents
Create folder PrivateResources
Copy your image into new folder
Back in Contents edit Manifest.plist
Add XML lines to top-level <dict> :
<key>ImageReference</key>
<string><your image file name></string>
Open playground in question and edit (!). I found editing crucial as the icon didn't appear after just opened/ closed the playground without at least a minor edit.
I did it all on my iPad using Textastic for folder creation, file copying, and editing.