mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
634f06688c
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
25 lines
733 B
Swift
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
|
|
}
|