Fix compilation for visionOS (#44)

This commit is contained in:
Vatsal Manot 2023-12-03 08:19:32 -08:00 committed by GitHub
parent 825e0f112a
commit bf6f133381
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View file

@ -41,6 +41,7 @@ If you still have a question, enhancement, or a way to improve Pow, this project
- iOS 15.0+
- macOS 12.0
- Mac Catalyst 15.0+
- visionOS beta 6 (requires Xcode 15.1 beta 3)
## Change Effects
@ -136,7 +137,7 @@ The shape will be colored by the current tint style.
```
An effect that adds one or more shapes that slowly grow and fade-out behind the view.
- Parameters:
- `shape`: The shape to use for the effect.
- `style`: The style to use for the effect.

View file

@ -54,7 +54,7 @@ private struct SmokeEffect: ViewModifier, Continuous {
GeometryReader { proxy in
ZStack {
ForEach(Array(particles.enumerated()), id: \.element) { (offset, particle) in
#if os(iOS)
#if os(iOS) || os(visionOS)
let image = UIImage(named: particle, in: .module, with: nil)!.cgImage!
#elseif os(macOS)
let image = Bundle.module.image(forResource: particle)!.cgImage(forProposedRect: nil, context: nil, hints: nil)!
@ -67,7 +67,7 @@ private struct SmokeEffect: ViewModifier, Continuous {
}
}
#if os(iOS)
#if os(iOS) || os(visionOS)
private class EmitterView: UIView {
override class var layerClass : AnyClass {
return CAEmitterLayer.self

View file

@ -1,6 +1,6 @@
import SwiftUI
#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
protocol ViewRepresentable: UIViewRepresentable {
associatedtype ViewType = UIViewType
func makeView(context: Context) -> ViewType