Giter VIP home page Giter VIP logo

Comments (4)

fracturedsoftware avatar fracturedsoftware commented on July 28, 2024 1

from swiftui-sliders.

fracturedsoftware avatar fracturedsoftware commented on July 28, 2024

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.

ay42 avatar ay42 commented on July 28, 2024

@fracturedsoftware

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.

fracturedsoftware avatar fracturedsoftware commented on July 28, 2024

from swiftui-sliders.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.