SwiftUI 设置边框、透明度、阴影

前言 xcode 13.3iOS 15.41、设置边框 1.1 设置边框颜色 默认为1的边框 Image("turtlerock").border(.

前言

xcode 13.3
iOS 15.4

1、设置边框

1.1 设置边框颜色

默认为1的边框

Image("turtlerock").border(.red)

解释

    /// - Parameters:///   - content: A value that conforms to the ``ShapeStyle`` protocol,///     like a ``Color`` or ``HierarchicalShapeStyle``, that SwiftUI///     uses to fill the border.///   - width: The thickness of the border. The default is 1 pixel.////// - Returns: A view that adds a border with the specified style and width///   to this view.@inlinable public func border(_ content: S, width: CGFloat = 1) -> some View where S : ShapeStyle

在这里插入图片描述

1.2 设置边框颜色、宽度

设置边框颜色、宽度

Image("turtlerock").bor