Tetris/TetrisUI/NextTetrominoesView.swift

35 lines
856 B
Swift
Raw Normal View History

2019-10-16 18:39:18 +00:00
//
// NextTetrominoesView.swift
// Tetris
//
// Created by Shadowfacts on 10/16/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import SwiftUI
import TetrisKit
public struct NextTetromioesView: View {
let size: CGFloat
2019-10-16 18:39:18 +00:00
let tetrominoes: [Tetromino]
public init(size: CGFloat, tetrominoes: [Tetromino]) {
self.size = size
2019-10-16 18:39:18 +00:00
self.tetrominoes = tetrominoes
}
public var body: some View {
VStack {
ForEach(0..<self.tetrominoes.count, id: \.self) { (index) in
TetrominoView(size: self.size / 4, tetromino: self.tetrominoes[index]).aspectRatio(1, contentMode: .fit)
2019-10-16 18:39:18 +00:00
}
}
}
}
struct NextTetrominoesView_Previews: PreviewProvider {
static var previews: some View {
NextTetromioesView(size: 50, tetrominoes: [.t, .l, .z])
2019-10-16 18:39:18 +00:00
}
}