Summary: This change drops the year from the copyright headers and the LICENSE file. Reviewed By: yungsters Differential Revision: D9727774 fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
45 lines
1.1 KiB
Swift
45 lines
1.1 KiB
Swift
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
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)
|
|
}
|
|
}
|