dmrschmidt / DSWaveformImage

Generate waveform images from audio files on iOS, macOS & visionOS in Swift. Native SwiftUI & UIKit views.
MIT License
978 stars 109 forks source link

Add support for VisionOS #81

Closed tapsandswipes closed 8 months ago

tapsandswipes commented 8 months ago

Add the changes needed to make this library usable in VisionOS

dmrschmidt commented 8 months ago

Hey @tapsandswipes,

thanks for the PR. I haven't played around with visionOS at all so far. So before I can merge this, I'll need to add an example app to the repo. Not sure how involved this will be, so I can't say when I'd get done with that.

tapsandswipes commented 8 months ago

No hurry. If I have time I'll create one and add it to this PR.

tapsandswipes commented 8 months ago

Done, I added a simple example app for VisionOS

dmrschmidt commented 8 months ago

Hey @tapsandswipes,

looks good in general, so I've just merged it in. Thanks a lot for this! There's remaining deprecation warnings for the use of onChange however, so I'll hold of with tagging a new release until I've removed those. I'd like to avoid any if @available branching for older iOS SDKs but will have to look into how to achieve that, especially since it's rather annoying to do with view modifiers. I believe it may be necessary though there's no earlier APIs that are not marked deprecated - I think.

Screenshot 2023-10-19 at 07 58 31
dmrschmidt commented 8 months ago

Well... had to revert this due to https://github.com/dmrschmidt/DSWaveformImage/commit/488812682c5392111502f4e6033062d5b642d35f#r130500076

Current state is in vision-os branch. I managed to get rid of the os(visionOS) related warnings, but then the .onChange failed again. I don't want to have open warnings in the library, so for until I figure out why the latest state in that branch still does not compile on Xcode 14 I'll leave it reverted. I must be missing something stupid.

tapsandswipes commented 8 months ago

OK, I understand. I guess we need some #if swift(>=5.9) checks around those #if os(visionOS). I'll try to take a look tomorrow.

dmrschmidt commented 8 months ago

The visionOS checks Ive already prefixed with that and it helped. However the actual updated onChange handler call now, despite being behind an if #available check, raises an error again.