Add macOS and tvOS platform support#39
Open
benroeder wants to merge 9 commits intoalexiscn:masterfrom
Open
Conversation
- Add macOS 10.13+ and tvOS 14.0+ deployment targets - Create MTTransitionsMacDemo SwiftUI app for macOS - Create MTTransitionsTVDemo SwiftUI app for tvOS with focus navigation - Add platform conditionals for UIKit/AppKit differences - Replace CADisplayLink with Timer on macOS - Fix deprecated AVVideoCodecH264 warning - Fix PI macro redefinition warning in MTStarWipeTransition.metal - Suppress unfixable Swift 6 Sendable warnings via compiler flag
- Restructure tvOS demo with tabbed interface (Image, UIView, ViewController) - Add UIView transition demo with cycle through all 76 effects - Add ViewController transition demo with push/present and cycle feature - Update README with platform support for each feature
- Add post_install hook to remove duplicate -lc++ linker flags - Disable App Intents metadata extraction (not used by library)
Fix Swift Package Manager warning about unhandled Assets.bundle file by explicitly declaring it as a processed resource.
When used as an SPM dependency, Metal shaders cannot be compiled offline. This adds runtime shader compilation using MetalPetal's library registration. Changes: - MTTransitionsSwiftPMSupport.mm: Embeds all 87 shader sources as strings - MTTransitionsSwiftPMSupport.h: Header for the ObjC function - MTTransition+SwiftPM.swift: Extension to use SPM library URL - MTTransition.swift: Use swiftPMLibraryURL for shader loading - Package.swift: Split into ObjC and Swift targets for mixed-language support The shaders are embedded as raw strings and compiled at runtime when SPM is detected via the SWIFT_PACKAGE preprocessor flag.
The previous approach used #include "MTIShaderLib.h" which doesn't work when compiling shaders at runtime with MTILibrarySourceRegistration because the Metal compiler can't find the header file. This commit inlines the essential MTIShaderLib.h content directly into the embedded shader source, including: - MTIVertex struct - metalpetal::VertexOut struct (required by all fragment shaders) - Utility functions (mod, sRGBToLinear, linearToSRGB, blend modes, etc.) This enables MTTransitions to work correctly when used as an SPM dependency with runtime shader compilation.
These macros may not be defined during runtime Metal shader compilation via MTILibrarySourceRegistration. Since we're always compiling for Metal, the conditional is unnecessary and was preventing the metalpetal namespace from being defined.
The .metal files were being compiled directly by xcodebuild for tvOS, but they couldn't find MTIShaderLib.h from MetalPetal. These files aren't needed for SPM builds since the shaders are embedded as strings in MTTransitionsSwiftPMSupport.mm for runtime compilation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan