Patterns
Dotpattern
DotPattern Component in SwiftUI
Overview
DotPattern
is a SwiftUI component for generating a dot pattern background. It provides customization options for setting the dot color, spacing between dots, brightness, and background color.
Preview
Installation
Include the DotPattern.swift
file in your SwiftUI project. File Link
Properties
dotColor: Color
(Default:Color.blue
) - The color of the dots.spacing: CGFloat
(Default:0
) - Additional spacing between dots.brightness: Double
(Default:1.0
, Range:0.0-1.0
) - Opacity of the dots.backgroundColor: Color
(Default:Color.black
) - The background color of the pattern.
Usage
Basic Usage
Here’s how you can use the DotPattern
component with default parameters:
Custom Usage
Here’s how you can use the DotPattern
component with custom parameters: