From bf6f1333810ea9c2eda4c758f8fadd39c247643c Mon Sep 17 00:00:00 2001 From: Vatsal Manot Date: Sun, 3 Dec 2023 08:19:32 -0800 Subject: [PATCH] Fix compilation for visionOS (#44) --- README.md | 3 ++- Sources/Pow/Effects/SmokeEffect.swift | 4 ++-- Sources/Pow/Infrastructure/ViewRepresentable.swift | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9527787..54f6f1c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/Sources/Pow/Effects/SmokeEffect.swift b/Sources/Pow/Effects/SmokeEffect.swift index feb00a6..a2141c6 100644 --- a/Sources/Pow/Effects/SmokeEffect.swift +++ b/Sources/Pow/Effects/SmokeEffect.swift @@ -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 diff --git a/Sources/Pow/Infrastructure/ViewRepresentable.swift b/Sources/Pow/Infrastructure/ViewRepresentable.swift index 3bcd886..0d076ea 100644 --- a/Sources/Pow/Infrastructure/ViewRepresentable.swift +++ b/Sources/Pow/Infrastructure/ViewRepresentable.swift @@ -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