Summary: This change applies all Arcanist recommended lint changes, which amounts to changing copyright headers and some cases of whitespace changes. Reviewed By: yungsters Differential Revision: D40060899 fbshipit-source-id: b62f9472e6ef58a3fc3d22eed661578a2635cb1f
46 lines
1.1 KiB
Swift
46 lines
1.1 KiB
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.
|
|
*/
|
|
|
|
import yoga;
|
|
postfix operator %
|
|
|
|
extension Int {
|
|
public static postfix func %(value: Int) -> YGValue {
|
|
return YGValue(value: Float(value), unit: .percent)
|
|
}
|
|
}
|
|
|
|
extension Float {
|
|
public static postfix func %(value: Float) -> YGValue {
|
|
return YGValue(value: value, unit: .percent)
|
|
}
|
|
}
|
|
|
|
extension CGFloat {
|
|
public static postfix func %(value: CGFloat) -> YGValue {
|
|
return YGValue(value: Float(value), unit: .percent)
|
|
}
|
|
}
|
|
|
|
extension YGValue : ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral {
|
|
public init(integerLiteral value: Int) {
|
|
self = YGValue(value: Float(value), unit: .point)
|
|
}
|
|
|
|
public init(floatLiteral value: Float) {
|
|
self = YGValue(value: value, unit: .point)
|
|
}
|
|
|
|
public init(_ value: Float) {
|
|
self = YGValue(value: value, unit: .point)
|
|
}
|
|
|
|
public init(_ value: CGFloat) {
|
|
self = YGValue(value: Float(value), unit: .point)
|
|
}
|
|
}
|