跳转至
Enumeration

Axis

The horizontal or vertical dimension in a 2D coordinate system.

Declaration

@frozen enum Axis : Int8, CaseIterable

Overview

Use this enumeration with ScrollView to specify whether the view can be scrolled vertically, horizontally, or both.

There are two possible axes:

  1. horizontal
  2. vertical

See init(_:showsIndicators:content:) for more details on using this enumeration in the initializer.

struct ContentView: View {
    var body: some View {
        ScrollView(Axis.Set.horizontal, showsIndicators: false) {
            VStack {
                Text("Bananas 🍌🍌")
                Text("Apples 🍏🍏")
                Text("Peaches 🍑🍑")
            }
        }
    }
}
A gif of a text view displaying three strings stacked on top of each other on the left side of the screen, scrolling side to side.

Availability

iOS 13.0+

macOS 10.15+

tvOS 13.0+

watchOS 6.0+

Topics


Initializer

init(rawValue:) Creates a new instance with the specified raw value.


Type Property

allCases A collection of all values of this type.


Structure

Set An efficient set of axes.


Case

horizontal The horizontal dimension.

vertical The vertical dimension.


Instance Property

description A textual representation of this instance.

rawValue The corresponding value of the raw type.


Type Alias

AllCases A type that can represent a collection of all values of this type.

RawValue The raw type that can be used to represent all values of the conforming type.