I have the following code snippet that draws a circular sector shape:
swift
struct CircularSector: Shape {
let centralAngle: Angle
func path(in rect: CGRect) - Path {
let radius = min(rect.width, rect.height) / 2
let center = CGPoint(x: rect.midX, y: rect.midY)
var path = Path()
path.addArc(center: center, radius: radius, startAngle: .degrees(0), endAngle: centralAngle, clockwise: true)
path.addLine(to: center)
path.closeSubpath()
return path
}
}
When I preview it,
swift
struct CircularSector_Previews: PreviewProvider {
static var previews: some View {
CircularSector(centralAngle: .degrees(45)).fill(Color.black)
}
}
}
instead of a 45° sector clockwise, it draws a 315° sector counterclockwise.
Post
Replies
Boosts
Views
Activity
Hi,
I'm attempting to create an app with an AI player for board games. The input is always an abstract state of the game, and never use image, video etc. classification. Would it be possible to use Core ML and Create ML for this purpose? Thanks!
Could Apple release the Mosaic project used in WWDC20 session 10149 - https://developer.apple.com/videos/play/wwdc2020/10149/? The project uses CloudKit and/or Core Data with the new SwiftUI, and can help answer questions the community has regarding how these frameworks work together:
https://developer.apple.com/forums/thread/650309
https://developer.apple.com/forums/thread/650173
https://developer.apple.com/forums/thread/649860
What was the keyboard shortcut used for selecting multiple parameter values in the same function? I can only tell that the option key was used because of the plus-shaped cursor. But the cursor itself didn't move after selecting the first parameter value, so there must be some other keys used in combination.