Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix-access-signature
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrandonw committed Oct 30, 2024
2 parents 3319937 + 7335e4a commit a25a34f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/Perception/Macros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,30 @@
//
//===----------------------------------------------------------------------===//

@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)
@attached(extension, conformances: Perceptible, _Observable)
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")
4 changes: 4 additions & 0 deletions Sources/Perception/Perceptible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
19 changes: 19 additions & 0 deletions Sources/Perception/PerceptionChecking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Sources/Perception/PerceptionRegistrar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions Sources/Perception/WithPerceptionTracking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Content> {
@State var id = 0
let content: () -> Content
Expand Down

0 comments on commit a25a34f

Please sign in to comment.