Initializer

init(_:)

Creates a progress view based on a style configuration.

Declaration 宣言

Available when Label conforms to View and CurrentValueLabel conforms to View.

Discussion 議論

You can use this initializer within the makeBody(configuration:) method of a ProgressViewStyle to create an instance of the styled progress view. This is useful for custom progress view styles that only modify the current progress view style, as opposed to implementing a brand new style.

For example, the following style adds a dark blue shadow to the progress view, but otherwise preserves the progress view’s current style:


struct DarkBlueShadowProgressViewStyle: ProgressViewStyle {
    func makeBody(configuration: Configuration) -> some View {
        ProgressView(configuration)
            .shadow(color: Color(red: 0, green: 0, blue: 0.6),
                    radius: 4.0, x: 1.0, y: 2.0)
    }
}

See Also 参照

Creating a Configured Progress View