35 lines
856 B
Swift
35 lines
856 B
Swift
//
|
|
// 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
|
|
let tetrominoes: [Tetromino]
|
|
|
|
public init(size: CGFloat, tetrominoes: [Tetromino]) {
|
|
self.size = size
|
|
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)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct NextTetrominoesView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
NextTetromioesView(size: 50, tetrominoes: [.t, .l, .z])
|
|
}
|
|
}
|