From 4f7fe004273107fb887aaca0531a849dc0eb68bf Mon Sep 17 00:00:00 2001 From: kikiloveswift Date: Tue, 5 Nov 2024 22:48:35 +0800 Subject: [PATCH] ADD: spine-ios support Cocoapods :Static Framework (#2658) Co-authored-by: liqiang --- Spine.podspec | 6 +++++- spine-ios/Sources/Spine/Metal/SpineRenderer.swift | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Spine.podspec b/Spine.podspec index 8842c989e..8c67181ad 100644 --- a/Spine.podspec +++ b/Spine.podspec @@ -14,13 +14,17 @@ Spine runtimes for iOS. s.license = { :file => 'LICENSE' } s.source = { :git => 'https://github.com/esotericsoftware/spine-runtimes.git', :branch => '4.2' } - s.source_files = 'spine-ios/Sources/Spine/**/*.{swift,metal}' + s.source_files = 'spine-ios/Sources/Spine/**/*.{swift}' s.platform = :ios, '13.0' s.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/SpineCppLite/spine-cpp/spine-cpp/include" "$(PODS_ROOT)/SpineCppLite/spine-cpp/spine-cpp-lite"' } + s.resource_bundles = { + 'SpineBundle' => ['spine-ios/Sources/Spine/**/*.{metal}'] + } + s.swift_version = '5.0' s.dependency 'SpineCppLite' s.dependency 'SpineShadersStructs' diff --git a/spine-ios/Sources/Spine/Metal/SpineRenderer.swift b/spine-ios/Sources/Spine/Metal/SpineRenderer.swift index 04ce6d951..b9692cdca 100644 --- a/spine-ios/Sources/Spine/Metal/SpineRenderer.swift +++ b/spine-ios/Sources/Spine/Metal/SpineRenderer.swift @@ -61,7 +61,8 @@ internal final class SpineRenderer: NSObject, MTKViewDelegate { #if SWIFT_PACKAGE // SPM bundle = .module #else // CocoaPods - bundle = Bundle(for: SpineRenderer.self) + let bundleURL = Bundle(for: SpineRenderer.self).url(forResource: "SpineBundle", withExtension: "bundle") + bundle = Bundle(url: bundleURL!)! #endif let defaultLibrary = try device.makeDefaultLibrary(bundle: bundle)