mirror of
https://github.com/EmergeTools/Pow.git
synced 2026-03-25 08:55:50 +00:00
Add tvOS support (#66)
This commit is contained in:
parent
5ac7140413
commit
f0d0f3e72d
5 changed files with 9 additions and 4 deletions
|
|
@ -10,7 +10,8 @@ let package = Package(
|
||||||
platforms: [
|
platforms: [
|
||||||
.iOS(.v15),
|
.iOS(.v15),
|
||||||
.macOS(.v12),
|
.macOS(.v12),
|
||||||
.macCatalyst(.v15)
|
.macCatalyst(.v15),
|
||||||
|
.tvOS(.v15)
|
||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ private struct SmokeEffect: ViewModifier, Continuous {
|
||||||
GeometryReader { proxy in
|
GeometryReader { proxy in
|
||||||
ZStack {
|
ZStack {
|
||||||
ForEach(Array(particles.enumerated()), id: \.element) { (offset, particle) in
|
ForEach(Array(particles.enumerated()), id: \.element) { (offset, particle) in
|
||||||
#if os(iOS) || os(visionOS)
|
#if os(iOS) || os(visionOS) || os(tvOS)
|
||||||
let image = UIImage(named: particle, in: .module, with: nil)!.cgImage!
|
let image = UIImage(named: particle, in: .module, with: nil)!.cgImage!
|
||||||
#elseif os(macOS)
|
#elseif os(macOS)
|
||||||
let image = Bundle.module.image(forResource: particle)!.cgImage(forProposedRect: nil, context: nil, hints: nil)!
|
let image = Bundle.module.image(forResource: particle)!.cgImage(forProposedRect: nil, context: nil, hints: nil)!
|
||||||
|
|
@ -70,7 +70,7 @@ private struct SmokeEffect: ViewModifier, Continuous {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(iOS) || os(visionOS)
|
#if os(iOS) || os(visionOS) || os(tvOS)
|
||||||
private class EmitterView: UIView {
|
private class EmitterView: UIView {
|
||||||
override class var layerClass : AnyClass {
|
override class var layerClass : AnyClass {
|
||||||
return CAEmitterLayer.self
|
return CAEmitterLayer.self
|
||||||
|
|
@ -172,7 +172,7 @@ private struct SmokeLayerView: ViewRepresentable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG && !os(tvOS)
|
||||||
struct ContinuousParticleEffect_Previews: PreviewProvider {
|
struct ContinuousParticleEffect_Previews: PreviewProvider {
|
||||||
private struct Preview: View {
|
private struct Preview: View {
|
||||||
@State
|
@State
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import Foundation
|
||||||
|
|
||||||
@available(iOS 16.0, *)
|
@available(iOS 16.0, *)
|
||||||
@available(macOS 13.0, *)
|
@available(macOS 13.0, *)
|
||||||
|
@available(tvOS 16.0, *)
|
||||||
internal extension Duration {
|
internal extension Duration {
|
||||||
var timeInterval: TimeInterval {
|
var timeInterval: TimeInterval {
|
||||||
TimeInterval(components.seconds) + TimeInterval(components.attoseconds) / 1e18
|
TimeInterval(components.seconds) + TimeInterval(components.attoseconds) / 1e18
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
#if !os(tvOS)
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct AngleControl<Label: View>: View {
|
struct AngleControl<Label: View>: View {
|
||||||
|
|
@ -132,3 +133,4 @@ struct AngleControl_Previews: PreviewProvider {
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ public struct AnyConditionalEffect {
|
||||||
/// - interval: The duration between each change effect.
|
/// - interval: The duration between each change effect.
|
||||||
@available(iOS 16.0, *)
|
@available(iOS 16.0, *)
|
||||||
@available(macOS 13.0, *)
|
@available(macOS 13.0, *)
|
||||||
|
@available(tvOS 16.0, *)
|
||||||
public static func `repeat`(_ effect: AnyChangeEffect, every interval: Duration) -> AnyConditionalEffect {
|
public static func `repeat`(_ effect: AnyChangeEffect, every interval: Duration) -> AnyConditionalEffect {
|
||||||
AnyConditionalEffect(guts: .repeating(effect, interval.timeInterval))
|
AnyConditionalEffect(guts: .repeating(effect, interval.timeInterval))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue