Comments (4)
from swiftui-sliders.
I am using your sliders package for some sliders in my app, but I am having trouble figuring out how to make a small configuration change to the slider. The slider I am using is just the basic horizontal slider. The default slider has a range of 0.0...1.0 but I really need to alter the range slightly to avoid a divide by 0 error. My understanding is that this is easily done but I can quite figure out how.
I have:
HSlider(value: self.$model.currentScale, configuration: .init( thumbSize: CGSize(width: 8, height: 8))
And my understanding is that I can add a ClosedRange as part of the init(). I tried to make a ClosedRange:
var range: ClosedRange = 0.0...1.0
But can't figure out how to add it. The errors I get are completely unhelpful showing errors after and before that have nothing to do with the problem. Thanks!
from swiftui-sliders.
HSlider(
value: self.$model.currentScale,
in: .leastNonzeroMagnitude...1.0,
configuration: .init( thumbSize: CGSize(width: 8, height: 8)
)
This should work. Your currentScale type should be the same as in range's types.
Let me know if it works for you.
from swiftui-sliders.
from swiftui-sliders.
Related Issues (20)
- UI glitch in horizontal sliders example
- Example project does not compile
- Range slider in documentation example only displays one handle HOT 1
- Click on slider track should adjust value HOT 2
- Use horizontal slider in horizontal Scrollview
- Thumb over the range slider HOT 1
- Range Slider preset data HOT 1
- Xcode 13 shows `Invalid Exclude` HOT 1
- Erros on xCode 13.0. HOT 2
- LowerThumb moves UpperThumb HOT 1
- Track colors HOT 2
- Using Value Slider unable to get thum
- Minimum Difference between upperBound and lowerBound HOT 3
- Are There Any Examples Besides the Two in the README? HOT 2
- State update in `onEditingChanged` freezes app
- Add step property. HOT 3
- Alternative step value with option key
- Examples? HOT 2
- minimumDistance for RangeSlider
- how to track change events and end changes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftui-sliders.