Reputation: 38727
For the following:
struct Constants {
static let m2Pi = CGFloat(M_PI) * 2
}
SwiftLint 0.16.1 is warning me:
warning: Legacy Constant Violation: Struct-scoped constants are preferred over legacy global constants. (legacy_constant)
Note that I need this value for UIBezierPath.init(arcCenter center: CGPoint, radius: CGFloat, startAngle: CGFloat, endAngle: CGFloat, clockwise: Bool)
to get a closed arc.
Upvotes: 0
Views: 827
Reputation: 1809
In swift 3, pi is now defined this way:
CGFloat.pi
You can also get it this way:
Double.pi
Float.pi
Upvotes: 6