Start

Поехали!

struct ContentView: View {
  var body: some View {
    Text("30")
      .font(.title)
      .fontWeight(.bold)
      .foregroundColor(Color.green)
  }
}
@State var score = 0
Button(action: {
  self.score += 10
}) {
  Text("Restart")
}
HStack {
  Spacer()
  Button(action: {
    self.score += 10
  }) {
    Text("Restart")
  }
}
struct ContentView: View {
  var body: some View {
    ZStack {
      ControlPanelView()
    }
  }
}
struct ControlPanelView: View {
  @State var score = 0
  var body: some View {
    VStack {
      HStack {
        Spacer()
        Text("\(score)")
          .font(.title)
          .fontWeight(.bold)
          .foregroundColor(Color.green)
      }
      Spacer()
      HStack {
        Spacer()
        Button(action: {
          self.score += 10
        }) {
          Text("Restart")
        }
      }
    }
    .padding()
  }
}

Скачать файл GameField.png

struct LabelView: View {
  let title: String
  var body: some View {
    Text(title)
      .font(.title)
      .fontWeight(.bold)
      .foregroundColor(Color.green)
  }
}
struct ButtonLabel: View {
  let title: String
  var body: some View {
    Text(title)
      .font(.title)
      .fontWeight(.bold)
  }
}
struct GameFieldView: View {
  var body: some View {
    Circle()
  }
}
struct GameFieldView: View {
  var width: CGFloat = 46.0
  var body: some View {
    Circle()
    .frame(width: width, height: width)
  }
}
ZStack {
  Image("GameField")
    .resizable()
    .aspectRatio(contentMode: .fit)
  Circle()
    .frame(width: width, height: width)
}
ZStack(alignment: .topLeading)
Circle()
  .frame(width: width, height: width)
  .scaleEffect(0.7)
  .offset(x: 8.0 * width, y: 8.0 * width)
struct BallView: View {
  let width: CGFloat
  let row: Int
  let column: Int
  var body: some View {
    Circle()
      .frame(width: width, height: width)
      .scaleEffect(0.7)
      .offset(x: CGFloat(column - 1) * width, y: CGFloat(row - 1) * width)
  }
}
BallView(width: width, row: 5, column: 9)
ForEach(1 ..< 10) { j in
  BallView(width: self.width, row: 5, column: j)
}
ForEach(1 ..< 10) { i in
  ForEach(1 ..< 10) { j in
    BallView(width: self.width, row: i, column: j)
  }
}
struct GameFieldView: View {
  var width: CGFloat = 46.0
  var fieldView: some View {
    Image("GameField")
      .resizable()
      .aspectRatio(contentMode: .fit)
  }
  var ballsView: some View {
    ForEach(1 ..< 10) { i in
      ForEach(1 ..< 10) { j in
        BallView(width: self.width, row: i, column: j)
      }
    }
  }
  var body: some View {
    ZStack(alignment: .topLeading) {
      fieldView
      ballsView
    }
  }
}
Circle()
.fill(RadialGradient(
  gradient: Gradient(colors: [Color.white, Color.blue]),
  center: .init(x: 0.35, y: 0.35),
  startRadius: 0.09 * width,
  endRadius: 0.5 * width))

FF40FF
008F51
0432FF
FF9200
F7F025
F02228
0096FF

Скачать проект iLines001.zip

далее https://macservice.kz/pedestal