X-Git-Url: https://git.r.bdr.sh/rbdr/patterns/blobdiff_plain/1418fe49617f5d35b14b19fe0ead15fcc43526c8..ba4ee0edf2aba19ad73fa53cb01dd0fb9b527526:/Sources/Patterns/Tile.swift?ds=inline diff --git a/Sources/Patterns/Tile.swift b/Sources/Patterns/Tile.swift deleted file mode 100644 index 3893324..0000000 --- a/Sources/Patterns/Tile.swift +++ /dev/null @@ -1,43 +0,0 @@ -import SwiftUI - -public struct Tile: View { - - let design: TileDesign - var pixelSize: CGFloat = 2.0; - var foregroundColor: Color = .black - var backgroundColor: Color = .white - - private var pixels: [Int] { - design.pixels() - } - - public var body: some View { - VStack(spacing: 0) { - ForEach(0 ..< 8) { i in - HStack(spacing: 0) { - ForEach(0 ..< 8) { j in - Rectangle() - .frame(width: pixelSize, height: pixelSize) - .foregroundColor(pixels[(i % 8) * 8 + j % 8] == 0 - ? foregroundColor - : backgroundColor - ) - } - } - } - } - } -} - -struct Tile_Previews: PreviewProvider { - static var previews: some View { - VStack { - Text("Default") - Tile(design: .grid) - Text("Color override") - Tile(design: .balls, foregroundColor: .pink, backgroundColor: .cyan) - Text("Pixel size override") - Tile(design: .shingles, pixelSize: 8.0) - } - } -}