🌀floating +−⨉÷ int
// 2022.02.15 (+) : operators +, -
// 2022.02.22 (r) : generalize from CGFloat to FloatingPoint
import SwiftUI
extension FloatingPoint {
/// `fp + int`
static public func + (a: Self, n: Int) -> Self {
a + Self(n)
}
/// `fp - int`
static public func - (a: Self, n: Int) -> Self {
a - Self(n)
}
/// `fp * int`
static public func * (a: Self, n: Int) -> Self {
a * Self(n)
}
/// `fp / int`
static public func / (a: Self, n: Int) -> Self {
a / Self(n)
}
}
is custom Operators on FloatingPoint and Int.
operate on CGFloat (Core Graphicstype) and Int.
CGFloat is BinaryFloatingPoint.
even-odd fill mode - 用於計算每層內縮的量
MyGrid - calculate cell view aspect ratio.
Loading Indicators (dots) - used in
.delay( 0.2 * i )
.
History
2022.02.22
// 2022.02.15 (+) : operators +, -
import SwiftUI
/// `cgFloat + int`
public func + (a: CGFloat, n: Int) -> CGFloat {
a + CGFloat(n)
}
/// `cgFloat - int`
public func - (a: CGFloat, n: Int) -> CGFloat {
a - CGFloat(n)
}
/// `cgFloat * int`
public func * (a: CGFloat, n: Int) -> CGFloat {
a * CGFloat(n)
}
/// `cgFloat / int`
public func / (a: CGFloat, n: Int) -> CGFloat {
a / CGFloat(n)
}
Last updated