Post

Replies

Boosts

Views

Activity

Reply to Swift Playground show hidden-code and other tags, unable to open Playground
As said earlier, you could edit the source swift file by navigating to it on the mac by right clicking on your playground and selected 'Show Package Contents' and do the same for the UserEdits.diffpack in Edits folder inside the playground where all the code you have written in the swift playground apps! Thanks this helped a lot! I managed to remove the unclosed tag that was cause the error by opening the main.swift.delta file in text editor, but when looking through this file it seems it only contains the code that wasn't hidden. I'm still unable to find the original code that I hid in any of the Chapters folder in the UserEdits.diffpack.
Apr ’21
Reply to Adding custom material to sceneReconstruction mesh
@stevecfox Leaving this here in case someone else also wonders this, but coming from the GitHub the 'asSIMD3' is an extension of GeometrySource: extension GeometrySource { @MainActor func asArray<T>(ofType: T.Type) -> [T] { assert(MemoryLayout<T>.stride == stride, "Invalid stride \(MemoryLayout<T>.stride); expected \(stride)") return (0..<self.count).map { buffer.contents().advanced(by: offset + stride * Int($0)).assumingMemoryBound(to: T.self).pointee } } // SIMD3 has the same storage as SIMD4. @MainActor func asSIMD3<T>(ofType: T.Type) -> [SIMD3<T>] { return asArray(ofType: (T, T, T).self).map { .init($0.0, $0.1, $0.2) } } }
Aug ’24