Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PackageDescription
let package = Package(
name: "Sticker",
platforms: [
.iOS(.v17),
.iOS(.v16),
.macOS(.v14),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to drop the macOS version to its iOS 16 equivalent too?

.visionOS(.v1)
],
Expand Down
4 changes: 3 additions & 1 deletion Sources/Sticker/StickerEffect/StickerEffect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import SwiftUI

@available(iOS 17, *)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package is available on other platforms than iOS. You need to check for these platforms too

private struct StickerEffectViewModifier: ViewModifier {
@State private var motion: StickerMotion = .init()

Expand Down Expand Up @@ -73,14 +74,15 @@ private struct StickerEffectViewModifier: ViewModifier {
extension View {
@ViewBuilder
public func stickerEffect(_ isEnabled: Bool = true) -> some View {
if isEnabled {
if isEnabled, #available(iOS 17, *) {
modifier(StickerEffectViewModifier())
} else {
self
}
}
}

@available(iOS 17, *)
#Preview {
VStack {
Circle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import SwiftUI
import CoreMotion

@available(iOS 17, *)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it required here? I don't see any iOS 17+ related API here

public struct AccelerometerStickerMotionEffect: StickerMotionEffect {
let intensity: Double
let maxRotation: Angle
Expand Down Expand Up @@ -45,6 +46,7 @@ public struct AccelerometerStickerMotionEffect: StickerMotionEffect {
}
}

@available(iOS 17, *)
public extension StickerMotionEffect where Self == AccelerometerStickerMotionEffect {
static var accelerometer: Self {
.accelerometer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
//

import SwiftUI
import Observation

@Observable
final class StickerShaderUpdater {
typealias ChangeHandler = (_ motion: StickerMotion) -> Void

Expand Down
2 changes: 2 additions & 0 deletions Sources/Sticker/Utils/Extensions/ShaderLibraryExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import SwiftUI

@available(iOS 17, *)
extension ShaderLibrary {
static var moduleLibrary: ShaderLibrary { .bundle(.module) }

Expand Down Expand Up @@ -53,6 +54,7 @@ extension ShaderLibrary {
}
}

@available(iOS 17, *)
public extension ShaderLibrary {
@available(iOS 18.0, macOS 15.0, visionOS 2.0, tvOS 18.0, watchOS 11.0, *)
static func compileStickerShaders() async throws {
Expand Down