IMG_2861.jpeg
//
// ContentView.swift
// LearnSwiftUILesson
//
// Created by 王勋才 on 2022/6/8.
//苹果|应用|商店|搜|王勋才|有我全部作品
import SwiftUI
struct ContentView: View {
@State private var showingSheet = false
@State var width:CGFloat = 500
@State var p:CGPoint = CGPoint(x: 0, y: 0)
var body: some View {
HStack{
ChessView(text: "1")
ChessView(text: "2",color: .orange)
ChessView(text: "3",color: .yellow)
ChessView(text: "4",color: .green)
}
.frame(maxWidth: .infinity,maxHeight: .infinity)
.background(Color.indigo)
}
}
struct ChessView: View {
var text:String
var color:Color = Color.red
var body: some View {
ZStack {
Circle()
.fill(color.shadow(.inner(radius: 10)))
.frame(width: 200,height: 200)
.shadow(radius: 10)
Text(text)
.font(.system(size: 80))
.bold()
.foregroundColor(Color.white)
}
}
}
网友评论