X-Git-Url: https://git.r.bdr.sh/rbdr/patterns/blobdiff_plain/90eb1b2137e0b80dc3af7e544c973971e45eab5a..ba4ee0edf2aba19ad73fa53cb01dd0fb9b527526:/README.md diff --git a/README.md b/README.md index 512e2a0..900c4b2 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ same effect as `Pattern` mentioned above ... -PatternView(design: $pattern) +PatternView(design: $design) .frame(width: 32.0).border(.black) .onTapGesture { shouldShowPatternPicker = !shouldShowPatternPicker; @@ -80,7 +80,7 @@ PatternView(design: $pattern) .popover(isPresented: $shouldShowPatternPicker) { PatternPicker(selectedDesign: $design) } - .onChange(of: pattern) { _ in + .onChange(of: design) { _ in shouldShowPatternPicker = false; } ``` @@ -97,12 +97,16 @@ PatternView(design: $pattern) * watchOS 8+ * catalyst 15+ -## The Tile view +## The TileImage struct If you'd like to do other things with the individual tiles, we also provide the -Tile view, which is just a single tile. +TileImage struct, which generates a CGImage. -The tiles support the same properties as `PatternView` with the exception that -`design` is a `TileDesign` and not a `Binding` +The tiles support similar properties as `PatternView` with the exception that + +* `design: TileDesign`: **required**, which design to use to tile the frame. +* `pixelSize: CGFloat`: **defaults to 2.0**, the size of a pixel in the tile. +* `foregroundColor: CGColor`: **defaults to black**, the foreground color. +* `backgroundColor: CGColor`: **defaults to white**, the background color. ![Screenshots of the tiles showing the different overrides](./doc/images/tile_example.png)