SwiftUI 为我们提供了各种梯度选项,所有这些选项都可以通过多种方式使用. Gradient 渐变器 A color gradient represented as an array of color stops, each having a parametric location value. gradient是一组颜色的合集,每个颜色都忽略位置参数 LinearGradient 线性渐变器 线性渐变器拥有沿轴进行渐变函数,我们可以自定义设置颜色空间.起点和终点. 下面我们看看Linear
clipped()函数介绍 Clips the view to its bounding rectangular frame. 将View裁剪成矩形 By default, a view's bounding frame is used only for layout, so any content that extends beyond the edges of the frame is still visible. Use the clipped(antialiased:)modifier
$0表示传递给Swift闭包的第一个参数,是Swift语言的语法糖.Swift会自动为内联闭包提供速记参数名称,可使用$0,$1,$2等名称来引用闭包参数的值. 代码 import UIKit let name = [1,2,3,9,8,6] let reverseName = name.sorted(by:{$0>$1}) let reverseName2 = name.sorted(by:{$1>$0}) print(name) print(reverseName) print(rever