diff --git a/Sources/Perception/Macros.swift b/Sources/Perception/Macros.swift index c224b3e..7eba273 100644 --- a/Sources/Perception/Macros.swift +++ b/Sources/Perception/Macros.swift @@ -9,6 +9,10 @@ // //===----------------------------------------------------------------------===// +@available(iOS, deprecated: 17, renamed: "Observable") +@available(macOS, deprecated: 14, renamed: "Observable") +@available(watchOS, deprecated: 10, renamed: "Observable") +@available(tvOS, deprecated: 17, renamed: "Observable") @attached( member, names: named(_$id), named(_$perceptionRegistrar), named(access), named(withMutation)) @attached(memberAttribute) @@ -16,11 +20,19 @@ public macro Perceptible() = #externalMacro(module: "PerceptionMacros", type: "PerceptibleMacro") +@available(iOS, deprecated: 17, renamed: "ObservationTracked") +@available(macOS, deprecated: 14, renamed: "ObservationTracked") +@available(watchOS, deprecated: 10, renamed: "ObservationTracked") +@available(tvOS, deprecated: 17, renamed: "ObservationTracked") @attached(accessor, names: named(init), named(get), named(set), named(_modify)) @attached(peer, names: prefixed(_)) public macro PerceptionTracked() = #externalMacro(module: "PerceptionMacros", type: "PerceptionTrackedMacro") +@available(iOS, deprecated: 17, renamed: "ObservationIgnored") +@available(macOS, deprecated: 14, renamed: "ObservationIgnored") +@available(watchOS, deprecated: 10, renamed: "ObservationIgnored") +@available(tvOS, deprecated: 17, renamed: "ObservationIgnored") @attached(accessor, names: named(willSet)) public macro PerceptionIgnored() = #externalMacro(module: "PerceptionMacros", type: "PerceptionIgnoredMacro") diff --git a/Sources/Perception/Perceptible.swift b/Sources/Perception/Perceptible.swift index adcc810..2358822 100644 --- a/Sources/Perception/Perceptible.swift +++ b/Sources/Perception/Perceptible.swift @@ -16,4 +16,8 @@ /// type doesn't add observation functionality to the type. Instead, always use /// the ``Perception/Perceptible()`` macro when adding observation /// support to a type. +@available(iOS, deprecated: 17, renamed: "Observable") +@available(macOS, deprecated: 14, renamed: "Observable") +@available(watchOS, deprecated: 10, renamed: "Observable") +@available(tvOS, deprecated: 17, renamed: "Observable") public protocol Perceptible {} diff --git a/Sources/Perception/PerceptionChecking.swift b/Sources/Perception/PerceptionChecking.swift index 32c67e1..11fa73e 100644 --- a/Sources/Perception/PerceptionChecking.swift +++ b/Sources/Perception/PerceptionChecking.swift @@ -11,11 +11,30 @@ import Foundation /// This check only happens in `DEBUG` builds, and so does not affect App Store releases of your /// app. However, the checks can sometimes be costly and slow down your app in development. If /// you wish to fully disable the checks, you can set this boolean to `false.` +@available( + iOS, deprecated: 17, message: "'isPerceptionCheckingEnabled' is no longer needed in iOS 17+" +) +@available( + macOS, deprecated: 14, message: "'isPerceptionCheckingEnabled' is no longer needed in macOS 14+" +) +@available( + watchOS, deprecated: 10, + message: "'isPerceptionCheckingEnabled' is no longer needed in watchOS 10+" +) +@available( + tvOS, deprecated: 17, message: "'isPerceptionCheckingEnabled' is no longer needed in tvOS 17+" +) public var isPerceptionCheckingEnabled: Bool { get { perceptionChecking.isPerceptionCheckingEnabled } set { perceptionChecking.isPerceptionCheckingEnabled = newValue } } +@available(iOS, deprecated: 17, message: "'_PerceptionLocals' is no longer needed in iOS 17+") +@available(macOS, deprecated: 14, message: "'_PerceptionLocals' is no longer needed in macOS 14+") +@available( + watchOS, deprecated: 10, message: "'_PerceptionLocals' is no longer needed in watchOS 10+" +) +@available(tvOS, deprecated: 17, message: "'_PerceptionLocals' is no longer needed in tvOS 17+") public enum _PerceptionLocals { @TaskLocal public static var isInPerceptionTracking = false @TaskLocal public static var skipPerceptionChecking = false diff --git a/Sources/Perception/PerceptionRegistrar.swift b/Sources/Perception/PerceptionRegistrar.swift index 4c00115..4c5828d 100644 --- a/Sources/Perception/PerceptionRegistrar.swift +++ b/Sources/Perception/PerceptionRegistrar.swift @@ -5,6 +5,10 @@ import IssueReporting /// /// You don't need to create an instance of `PerceptionRegistrar` when using /// the ``Perception/Perceptible()`` macro to indicate observability of a type. +@available(iOS, deprecated: 17, message: "Use 'ObservationRegistrar' instead.") +@available(macOS, deprecated: 14, message: "Use 'ObservationRegistrar' instead.") +@available(watchOS, deprecated: 10, message: "Use 'ObservationRegistrar' instead.") +@available(tvOS, deprecated: 17, message: "Use 'ObservationRegistrar' instead.") public struct PerceptionRegistrar: Sendable { private let _rawValue: AnySendable #if DEBUG diff --git a/Sources/Perception/WithPerceptionTracking.swift b/Sources/Perception/WithPerceptionTracking.swift index 2defc48..644b41b 100644 --- a/Sources/Perception/WithPerceptionTracking.swift +++ b/Sources/Perception/WithPerceptionTracking.swift @@ -47,6 +47,18 @@ /// To debug this, expand the warning in the Issue Navigator of Xcode (cmd+5), and click through /// the stack frames displayed to find the line in your view where you are accessing state without /// being inside ``WithPerceptionTracking``. + @available( + iOS, deprecated: 17, message: "'WithPerceptionTracking' is no longer needed in iOS 17+" + ) + @available( + macOS, deprecated: 14, message: "'WithPerceptionTracking' is no longer needed in macOS 14+" + ) + @available( + watchOS, deprecated: 10, message: "'WithPerceptionTracking' is no longer needed in watchOS 10+" + ) + @available( + tvOS, deprecated: 17, message: "'WithPerceptionTracking' is no longer needed in tvOS 17+" + ) public struct WithPerceptionTracking { @State var id = 0 let content: () -> Content