Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion ReactNativeNavigation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'

# Detect if this is a Swift project by looking for user AppDelegate.swift files
dependency_paths = ['/node_modules/', '/Pods/', '/build/', '/Build/', '/DerivedData/']
swift_project = Dir.glob('**/AppDelegate.swift')
.reject { |file| dependency_paths.any? { |path| file.include?(path) } }
.any?

# Debug output
if swift_project
puts "ReactNativeNavigation: Swift AppDelegate detected - enabling Swift-compatible configuration"
else
puts "ReactNativeNavigation: Objective-C AppDelegate detected - using standard configuration"
end

Pod::Spec.new do |s|
s.name = "ReactNativeNavigation"
s.version = package['version']
Expand All @@ -21,14 +34,29 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/wix/react-native-navigation.git", :tag => "#{s.version}" }
s.source_files = 'lib/ios/**/*.{h,m,mm,cpp}'
s.exclude_files = "lib/ios/ReactNativeNavigationTests/**/*.*", "lib/ios/OCMock/**/*.*"
# Only expose headers for Swift projects
if swift_project
s.public_header_files = [
'lib/ios/RNNAppDelegate.h'
]
end
end

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'
s.pod_target_xcconfig = {

# Base xcconfig settings
xcconfig_settings = {
'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"',
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
}

# Only add DEFINES_MODULE for Swift projects
if swift_project
xcconfig_settings["DEFINES_MODULE"] = "YES"
end

s.pod_target_xcconfig = xcconfig_settings

if fabric_enabled
install_modules_dependencies(s)
Expand Down
108 changes: 0 additions & 108 deletions autolink/fixtures/rn68/AppDelegate.mm.template

This file was deleted.

133 changes: 0 additions & 133 deletions autolink/fixtures/rn69/AppDelegate.mm.template

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
return true;
}

@end
@end
30 changes: 30 additions & 0 deletions autolink/fixtures/rn77/AppDelegate.swift.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import UIKit
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider

@main
class AppDelegate: RCTAppDelegate {
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
self.moduleName = "app"
self.dependencyProvider = RCTAppDependencyProvider()

// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = [:]

return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

override func sourceURL(for bridge: RCTBridge) -> URL? {
self.bundleURL()
}

override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
}
}
Loading