Repository navigation
Expand file tree
/
Copy pathNitroIap.podspec
More file actions
61 lines (52 loc) · 2.25 KB
/
Copy pathNitroIap.podspec
File metadata and controls
61 lines (52 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
versions_path = File.join(__dir__, "openiap-versions.json")
unless File.exist?(versions_path)
raise "NitroIap: Missing openiap-versions.json. Add the file to manage native dependency versions."
end
versions = JSON.parse(File.read(versions_path))
apple_version = versions["apple"]
unless apple_version.is_a?(String) && !apple_version.strip.empty?
raise "NitroIap: 'apple' version missing or invalid in openiap-versions.json"
end
Pod::Spec.new do |s|
s.name = "NitroIap"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]
# React Native IAP uses StoreKit 2 via OpenIAP, which requires iOS 15+.
# Enforce this at the podspec level so projects with a lower deployment target
# get a clear CocoaPods error instead of a vague SwiftCompile failure.
# Platform versions match OpenIAP requirements: iOS 15+, macOS 14+, tvOS 16+, watchOS 8+
s.platforms = { :ios => '15.0', :tvos => '16.0', :macos => '14.0', :watchos => '8.0', :visionos => 1.0 }
s.source = { :path => '.' }
s.source_files = [
"ios/**/*.{swift}",
"ios/**/*.{m,mm}",
]
s.exclude_files = [
"ios/RnIap-Bridging-Header.h",
]
load 'nitrogen/generated/ios/NitroIap+autolinking.rb'
add_nitrogen_files(s)
s.dependency 'React-Core'
s.dependency 'React-jsi'
s.dependency 'React-callinvoker'
# OpenIAP comes from its Swift package at the exact pinned version.
# OPENIAP_APPLE_PATH (absolute) builds a local packages/apple checkout instead.
local_openiap = ENV['OPENIAP_APPLE_PATH'].to_s.strip
unless local_openiap.empty? || File.exist?(File.join(local_openiap, 'Package.swift'))
raise "OPENIAP_APPLE_PATH #{local_openiap} has no Package.swift"
end
unless defined?(spm_dependency)
raise 'NitroIap needs a React Native 0.75+ Podfile, which adds the OpenIAP Swift package'
end
spm_dependency(s,
url: local_openiap.empty? ? 'https://github.com/hyodotdev/openiap.git' : File.expand_path(local_openiap),
requirement: { kind: 'exactVersion', version: apple_version },
products: ['OpenIAP']
)
install_modules_dependencies(s)
end