nicklockwood / Euclid

A Swift library for creating and manipulating 3D geometry
MIT License
644 stars 53 forks source link

visionOS sample code: add view model, get Mesh construction off the main thread #116

Open halmueller opened 8 months ago

halmueller commented 8 months ago

ExampleVisionOS now has a view model, and creates the Mesh and Entity instances on a separate thread. I've added some sleep() time to simulate a long-running Mesh creation. The sample code now reflects typical SwiftUI patterns used in visionOS and in iOS 17+. No changes made to the Euclid codebase, just to the sample app.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.36%. Comparing base (1399eec) to head (ae3e6a8).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #116 +/- ## ======================================= Coverage 77.36% 77.36% ======================================= Files 32 32 Lines 8218 8218 ======================================= Hits 6358 6358 Misses 1860 1860 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

halmueller commented 8 months ago

As I get more experience on visionOS, I’m having second thoughts about this PR. The RealityView initialization is already async. I was seeing the placeholder view and thinking it was the equivalent of a beach ball. But nothing’s blocked, and I think I’ve made this example needlessly complex. I’m working on something different at the moment, will take another crack next week. If someone else wants to run with it you have my blessing.