pointfreeco / swift-perception

Observable tools, backported.
MIT License
575 stars 44 forks source link

Perception checking in iOS 17 and a bug fix #10

Closed mbrandonw closed 10 months ago

mbrandonw commented 10 months ago

This PR primarily adds perception checking even for iOS 17. We originally omitted perception checking in iOS 17 because the library will delegate down to Swift's native observation tools, and so technically WithPerceptionTracking isn't necessary. But of course you may be deploying for iOS 16 and testing on iOS 17, and so you probably want to know if you leave off the wrapper view.

I have also fixed #9. We have specific logic in isInSwiftUIBody for checking if state is being accessed from a SwiftUI action closure (such as onDelete { … }), but that logic doesn't work when passing a method directly (i.e. onDelete(perform: delete)). The fix is easy enough.