Git Product home page Git Product logo

Comments (7)

oscbyspro avatar oscbyspro commented on June 2, 2024

Side note: I haven’t tested it outside of Xcode 14 beta 5.

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

I think reentrance is definitely preferable because it introduces no downstream complexity, whereas special case styles introduce more options, and make it so you have to be aware of edge cases you may do not even have to consider otherwise.

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

Added in f930ce4 and it’s so much nicer 🤩

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

On a tangent: checking !update can replace the interaction lock (even the async one!). Who’d a thunk it.

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

“feels-good-man”

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

There’s some funky behavior in combination with UITextField’s normal “autocorrection” behavior, when tapping on an inactive field bound to an invalid value (an edge case among edge cases). UIKit may want to select some part of it and offer a suggestion, then the style immediately removes it because it’s invalid. This manifests as a single frame selection flash. diffableTextViews_autocorrectionDisabled() prevents this.


I’ll see if I can make it work nicely by default.


It’s possible. I’mma need that lock I binned tho. I can't get rid of the suggestion bubble that pops up, but I think that's OK.


Fixed in cb8eb65. Reintroduced: Lock to isolate reentrant calls to textFieldDidChangeSelection(_:).


Another flash happens whenever you actually accept a suggestion, but it also happens in SwiftUI.TextField and is therefore outside the scope of this project (whatever solution I add would just get rug-pulled by  if/when they fix it).


It's possible that the prior fix would also be unnecessary if the latter was fixed by .

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

There are some minor side effects of reentrant updates. Given:

.number.suffix(amount != nil ? “ items" : “”)

When the value is nil and the user types . the following happens:

0) initial: nil, ""
1) resolve:   0, “0. items”
-- the value is no longer nil so the style changes
2) interpret: 0, “0 items” (separator was removed)

It is unrelated to reentrancy and has to do with dynamic styles. Compare:

.number.equals(amount != nil)

from diffabletextviews.

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.