You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To simplify your custom label implementation, you can read `circularControlProgress` from environment.
129
+
130
+
### Environment Configuration
131
+
132
+
Configure behavior through environment values:
133
+
134
+
```swift
135
+
CircularControl(progress: $progress)
136
+
// Enable continuous wrapping (off by default).
137
+
.circularControlAllowsWrapping(true)
138
+
// Adjust the scale of the interactive knob.
139
+
.circularControlKnobScale(2.0)
140
+
```
141
+
142
+
### Progress Updates
143
+
144
+
You don't have to use the Binding-based initializer to support user interaction. Instead, you may provide an initial value, specify the `isEditable` parameter, and track changes via a closure.
145
+
146
+
```swift
147
+
CircularControl(
148
+
progress: progress,
149
+
isEditable: true
150
+
) { newValue in
151
+
print("Progress updated to \(newValue).")
152
+
}
153
+
```
154
+
155
+
## Migration
156
+
157
+
The API surface of PZCircularControl has been completely reworked in 1.0.0 to better match the latest Swift and SwiftUI conventions, support editing, and provide more opportunities for client customization. For details about the legacy API and support for older OS versions, view the section below.
158
+
159
+
Migration guide:
160
+
1. Replace `PZCircularControl` with `CircularControl`.
161
+
2. Convert `PZCircularControlParams` to the new style system.
162
+
3. Move any overlay views to the new label view builder.
163
+
4. Update progress handling to use the new binding-based API.
The params object's instance data can be modified and animated. For example, the following code animates the control to the 35% state when the button is tapped:
@@ -93,11 +249,13 @@ Some customization options include:
93
249
*`tintColor` – the tint color of the active area of your control. Has to conform to `ShapeStyle` (ie. anything from `Color` to `Gradient`).
94
250
*`textFormatter` – an optional closure that takes in a CGFloat value of the current progress between 0.0 and 1.0 and returns formatted text that will be displayed in the center of the progress bar.
95
251
252
+
</details>
253
+
96
254
## License
97
255
98
256
MIT License
99
257
100
-
Copyright (c) 2019-2021 Phil Zet (a.k.a. Phil Zakharchenko)
258
+
Copyright (c) 2019-2024 Phil Zakharchenko
101
259
102
260
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
0 commit comments