microsoft / react-native-macos

A framework for building native macOS apps with React.
https://microsoft.github.io/react-native-windows/
MIT License
3.39k stars 130 forks source link

Set build settings required for Swift in the template project #2067

Closed tsapeta closed 5 months ago

tsapeta commented 5 months ago

Please select one of the following

Summary:

As of Expo SDK50 it's possible to use Expo modules in react-native-macos projects. During pod install and a build phase script, expo-modules-autolinking generates a Swift file called ExpoModulesProvider.swift and adds it programmatically to the pbxproj using CocoaPods tooling. The problem is that the template project doesn't have SWIFT_VERSION build setting, which causes the below error when building:

Value for SWIFT_VERSION cannot be empty.

If we manually add a Swift file through Xcode, it automatically adds SWIFT_VERSION, SWIFT_OPTIMIZATION_LEVEL and CLANG_ENABLE_MODULES build settings to the target. These settings are already present in the target for iOS.

To made these changes, I simply manually added a dummy Swift file to the HelloWorld project and let Xcode update these settings.

Changelog:

[IOS] [CHANGED] - Set build settings required for Swift in the template project

Test Plan:

The newly generated project builds as expected (i.e. without the issue mentioned above) after applying this change and integrating it with Expo modules.