Giter Site home page Giter Site logo

swiftui-numberfield's Introduction

I got started in AppleSoft ][ BASIC, quickly got sucked into assembly language when my interests turned to interrupt-driven serial IO (because it was the mid-Eighties). I discovered UNIX and got my first serious exposure to C when I went to Drexel. I was the first technical hire at Infonautics back in 1994, where in addition to writing infrastructure, I wrote several versions of the Mac client of our education search engine and content management system. I was also jointly responsible for our first non-toy version of our web-based product, in part because I had probably written more Perl than anyone at the company thanks to spending too much time writing data-cleaning code for everything from dictionaries that came on nine-track tape to satellite-fed data from Reuters.

I also spent a decade writing Clojure. And I've written a lot of Python. These days, most of my work happens over on Sourcehut. I've been solving problems that happen to line up well with Go.

swiftui-numberfield's People

Contributors

dfunckt avatar edw avatar pyroh avatar upetersen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiftui-numberfield's Issues

Filtering for non-numeric values

What about doing some sort of filter to prevent non-numeric values?

right now if someone types in a letter it returns a blank.

I was thinking that the .onReceive could add a filter?

let filtered = newValue.filter { "0123456789".contains($0) }

I played with it but have not been successful.

Thanks.

Modifying state during view update, this will cause undefined behavior

So I've been following the same trail as you I think - https://stackoverflow.com/questions/58178825/swiftui-validation-and-vetoing-for-user-input is my one for the generic version of this question (any sort of input event -> validate -> rerender cycle)

As you probably know - the Modifying state during view update, this will cause undefined behavior message pops up for all the versions of this type of solution. My question is - does this actually cause issues? This seems like the cleanest solution apart from that warning.

And if you know - how else are you meant to actually modify @State types? You can't do it inside the body according to the message, and accessing it outside also causes warnings or errors.

Updating value when NumericTextField is already on screen doesn't update textValue until the TextField is selected

I have a special DecimalField, whose numeric value can be modified using a +/- button, which are part of the parent view of DecimalField. This means that textValue can no longer be the "source of truth" for value, since value can and needs to be modified by a parent view.

However, since value is only used in onAppear and in onEditingChanged to update textValue, when modifying value directly from a parent view while DecimalField is already displayed on the screen, DecimalField is not updated until its TextField is selected.

Is there a way to resolve this issue?

Infinite Loop when used with @Published object

If I create a sample class:

class Sample: ObservedObject {
     @Published var myDecimal: Decimal
     @Published var someOtherVar: Bool
}

And Implement it like:

var myObject = Sample()
...
DecimalField("My Decimal", value: $myObject.myDecimal, formatter: Self.aFormatter)

The publisher and onRecieve methods go into a terminal loop that locks up the main thread and eventually crashes.

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.