Ellipse

The Ellipse is one of SwiftUI pre-built shapes like rectangles and circles.

Syntax

var body: some View {
    Ellipse()
        Modifiers here
}

Example

The following example makes a blue Ellipse with a dimension of 150 points wide by 50 points high:

var body: some View {
Ellipse()
.fill(.blue)
.frame(width: 150, height: 50)
}

This will display the following:

Ellipse

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn SwiftUI on Codecademy