Skip to content

Add explicit UIKit/AppKit imports for Library Evolution support#137

Closed
shreks7 wants to merge 1 commit intoSvenTiigi:mainfrom
chef-recipe:bugfix/library_evolution_support
Closed

Add explicit UIKit/AppKit imports for Library Evolution support#137
shreks7 wants to merge 1 commit intoSvenTiigi:mainfrom
chef-recipe:bugfix/library_evolution_support

Conversation

@shreks7
Copy link
Contributor

@shreks7 shreks7 commented Oct 4, 2025

To allow YouTubePlayerKit to be used part of the xcframework and when
BUILD_LIBRARY_FOR_DISTRIBUTION=YES is set.

@SvenTiigi
Copy link
Owner

Great find 👍

Have you tried to just use import SwiftUI as it already handles the conditional import of UIKit and AppKit?
Similarly to the conditional declaration of the Image typealias of the YouTubeVideoThumbnail which only imports SwiftUI.

#if os(macOS)
/// A video thumbnail image.
typealias Image = NSImage
#else
/// A video thumbnail image.
typealias Image = UIImage
#endif

@shreks7
Copy link
Contributor Author

shreks7 commented Oct 5, 2025

Great find 👍

Have you tried to just use import SwiftUI as it already handles the conditional import of UIKit and AppKit? Similarly to the conditional declaration of the Image typealias of the YouTubeVideoThumbnail which only imports SwiftUI.

#if os(macOS)
/// A video thumbnail image.
typealias Image = NSImage
#else
/// A video thumbnail image.
typealias Image = UIImage
#endif

Ah that is simpler and easier! It works.

@shreks7 shreks7 closed this Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants