shaps80 / SwiftUIBackports

A collection of SwiftUI backports for iOS, macOS, tvOS and watchOS
MIT License
931 stars 59 forks source link

Cannot find type PlatformImage on tvOS #43

Closed Sherlouk closed 1 year ago

Sherlouk commented 1 year ago

Cannot find type 'PlatformImage' in scope when compiling v1.9.0 against tvOS 16.0.

Seems to be because the public typealias PlatformImage = UIImage is only set for iOS, not tvOS.

Sherlouk commented 1 year ago

We are many versions behind, but looks like the issue still exists here: https://github.com/shaps80/SwiftUIBackports/blob/main/Sources/SwiftUIBackports/Internal/Platforms.swift#L7

shaps80 commented 1 year ago

Interesting, I do test that it compiles across all platforms – can’t understand how it was working previously. In fact its compiling on Swift Package Index too. https://swiftpackageindex.com/shaps80/SwiftUIBackports

Do you think this could be something in your derived data perhaps? It may have been an issue in previous versions but perhaps since fixed?

shaps80 commented 1 year ago

Oh I see what you’re saying now, the issue is in 1.9.0 – which is possible for sure.

The code there is unchanged I think, but the code that was previously referencing that alias has changed is also now iOS only I believe. That’s why it works in newer versions. You’d need to update 👍🏻

Sherlouk commented 1 year ago

Aye, I hadn't checked latest versions and reviewing the code in repo (https://github.com/shaps80/SwiftUIBackports/blob/main/Sources/SwiftUIBackports/Shared/ShareLink/Transferable.swift) it seems a new compiler flag was added at top of file which resolves this.

Sorry for the noise! Must have been fixed, will upgrade. Thanks Shaps!

shaps80 commented 1 year ago

No problem! Always good to check just in case 👍🏻 Thanks for using the package, glad its useful ;)