Files
react-native/packages/rn-tester/RNTester/SwiftTest.swift
David Richey 634f06688c Apply SWIFTFORMAT to fbsource
Summary:
```
hg files -I '**/*.swift' \
| arc lint \
  --take SWIFTFORMAT \
  --apply-patches \
  --no-paths-check \
  --paths-from - \
  --eden-prefetch \
  --output none \
  > /dev/null
```

Reviewed By: ebgraham

Differential Revision: D73276943

fbshipit-source-id: 5432642a217fc1fa37eb97409a2cc282f65c3117
2025-04-20 18:08:18 -07:00

25 lines
733 B
Swift

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// The SwiftTest here in rn-tester acts as a guard to make sure that we can build React-Core clang module and import from Swift.
import React
func getReactNativeVersion() -> String {
let version = RCTGetReactNativeVersion()
guard let major = version?[RCTVersionMajor],
let minor = version?[RCTVersionMinor],
let patch = version?[RCTVersionPatch]
else {
fatalError()
}
var result = "\(major).\(minor).\(patch)"
if let prerelease = version?[RCTVersionPrerelease] {
result += "-\(prerelease)"
}
return result
}