SwiftUI Circle
Published Oct 21, 2022
Contribute to Docs
SwiftUI includes various pre-built shapes, like rectangles, circles, and capsules which can be generated, coloured, and positioned as desired.
Syntax
Circle()
// Modifiers
Circle is one of the pre-built shapes. A developer can add modifiers to use different properties such as fill, stroke, alignment, frame, borders, and size to adjust the circle according to their requirements.
Example
The following example make a Circle that is purple:
var body: some View {Circle().fill(.purple).frame(width: 200, height: 200)}
The above code generates a circle with a dimension of 200x200 points. This will display the following:

Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SwiftUI on Codecademy
- Learn how to build iOS applications with Swift and SwiftUI and publish them to Apples' App Store.
- Includes 7 Courses
- With Certificate
- Beginner Friendly.13 hours