aboutsummaryrefslogtreecommitdiff
path: root/Sources/Patterns/Pattern.swift
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2023-04-26 18:20:34 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2023-04-26 18:20:34 +0200
commitbf2790fca182f504255df877beff0ac0334cb2ca (patch)
treef7be6c0a2b2d7f3f5c172277a4de6403588dc9c5 /Sources/Patterns/Pattern.swift
parent68ce43557c7bb7bffc33e3c3f161d3a93f89e200 (diff)
Add explicit initializers
Diffstat (limited to 'Sources/Patterns/Pattern.swift')
-rw-r--r--Sources/Patterns/Pattern.swift40
1 files changed, 0 insertions, 40 deletions
diff --git a/Sources/Patterns/Pattern.swift b/Sources/Patterns/Pattern.swift
deleted file mode 100644
index 6c63870..0000000
--- a/Sources/Patterns/Pattern.swift
+++ /dev/null
@@ -1,40 +0,0 @@
-import SwiftUI
-
-public struct Pattern: View {
-
- @Binding public var design: TileDesign;
- public var pixelSize: CGFloat = 2.0;
- public var foregroundColor: Color = .black
- public var backgroundColor: Color = .white
-
- private var patternSize: CGFloat {
- pixelSize * 8.0;
- }
-
- public var body: some View {
- GeometryReader { gr in
- VStack(spacing: 0) {
- ForEach(0 ..< 1 + Int(ceil(gr.size.height / patternSize)), id: \.self) { i in
- HStack(spacing: 0) {
- ForEach(0 ..< Int(ceil(gr.size.width / patternSize)), id: \.self) { j in
- Tile(design: design, pixelSize: pixelSize, foregroundColor: foregroundColor, backgroundColor: backgroundColor)
- }
- }
- }
- }
- }.drawingGroup()
- }
-}
-
-struct Pattern_Previews: PreviewProvider {
- static var previews: some View {
- VStack {
- Text("Default")
- Pattern(design: .constant(TileDesign.grid))
- Text("Color override")
- Pattern(design: .constant(TileDesign.balls), foregroundColor: .pink, backgroundColor: .cyan)
- Text("Pixel size override")
- Pattern(design: .constant(TileDesign.shingles), pixelSize: 8.0)
- }
- }
-}