@@ -4,6 +4,19 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
44
55fabric_enabled = ENV [ 'RCT_NEW_ARCH_ENABLED' ] == '1'
66
7+ # Detect if this is a Swift project by looking for user AppDelegate.swift files
8+ dependency_paths = [ '/node_modules/' , '/Pods/' , '/build/' , '/Build/' , '/DerivedData/' ]
9+ swift_project = Dir . glob ( '**/AppDelegate.swift' )
10+ . reject { |file | dependency_paths . any? { |path | file . include? ( path ) } }
11+ . any?
12+
13+ # Debug output
14+ if swift_project
15+ puts "ReactNativeNavigation: Swift AppDelegate detected - enabling Swift-compatible configuration"
16+ else
17+ puts "ReactNativeNavigation: Objective-C AppDelegate detected - using standard configuration"
18+ end
19+
720Pod ::Spec . new do |s |
821 s . name = "ReactNativeNavigation"
922 s . version = package [ 'version' ]
@@ -21,14 +34,29 @@ Pod::Spec.new do |s|
2134 s . source = { :git => "https://github.com/wix/react-native-navigation.git" , :tag => "#{ s . version } " }
2235 s . source_files = 'lib/ios/**/*.{h,m,mm,cpp}'
2336 s . exclude_files = "lib/ios/ReactNativeNavigationTests/**/*.*" , "lib/ios/OCMock/**/*.*"
37+ # Only expose headers for Swift projects
38+ if swift_project
39+ s . public_header_files = [
40+ 'lib/ios/RNNAppDelegate.h'
41+ ]
42+ end
2443 end
2544
2645 folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DFOLLY_CFG_NO_COROUTINES=1'
27- s . pod_target_xcconfig = {
46+
47+ # Base xcconfig settings
48+ xcconfig_settings = {
2849 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/Headers/Private/React-Core" "$(PODS_ROOT)/Headers/Private/Yoga"' ,
2950 "CLANG_CXX_LANGUAGE_STANDARD" => "c++20" ,
3051 "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1" ,
3152 }
53+
54+ # Only add DEFINES_MODULE for Swift projects
55+ if swift_project
56+ xcconfig_settings [ "DEFINES_MODULE" ] = "YES"
57+ end
58+
59+ s . pod_target_xcconfig = xcconfig_settings
3260
3361 if fabric_enabled
3462 install_modules_dependencies ( s )
0 commit comments