swift 减小SF符号的边框宽度

bqf10yzr  于 2023-06-28  发布在  Swift
关注(0)|答案(1)|浏览(123)

减少图像的边框宽度,它的SF符号,我尝试了不同的方法,但它不工作

struct CheckboxView: View {
    var isSelected: Bool
    var size: CGSize = CGSize(width: 30, height: 30)
    var body: some View {
        Image(systemName: isSelected ? "rectangle.inset.filled" : "rectangle")
            .resizable()
            .frame(width: size.width, height: size.height)
    }
}

struct CheckboxView_Previews: PreviewProvider {
    static var previews: some View {
        CheckboxView(isSelected: false)
    }
}

当前


k2fxgqgv

k2fxgqgv1#

Image(systemName: isSelected ? "rectangle.inset.filled" : "rectangle")
    .resizable()
    .fontWeight(.light) // <--

甚至

Image(systemName: isSelected ? "rectangle.inset.filled" : "rectangle")
    .resizable()
    .fontWeight(.ultraLight) // <--

够薄吗

相关问题