Comments (7)
Side note: I haven’t tested it outside of Xcode 14 beta 5.
from diffabletextviews.
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.
Added in f930ce4 and it’s so much nicer 🤩
from diffabletextviews.
On a tangent: checking !update
can replace the interaction lock (even the async one!). Who’d a thunk it.
from diffabletextviews.
from diffabletextviews.
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.
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)
- Export `WrapperTextStyle` & `NullableTextStyle` HOT 1
- Add `Prefix`, `Suffix` and/or `Labels` wrappers HOT 3
- Rename `isolated()` modifier as `standalone()` HOT 1
- Replace `anchor` with `selection` HOT 2
- Improve `nil` + `prefix(_:)` & `suffix(_:)` interaction HOT 6
- Remove some wrapper conveniences HOT 1
- Add selection requirement on 100% formatting to `Commit` HOT 2
- Miscellaneous improvements HOT 9
- Add a `NormalTextStyle` HOT 2
- `Proposal/base` should be a `SubSequence` HOT 1
- Move selection from `Snapshot` to `Commit` HOT 3
- SwiftUI vs Xcode 14.0 beta 5-6 HOT 3
- Parsing (U)Int(8-64) > max `String` crashes HOT 3
- Consider `@_spi` attribute HOT 1
- Dismiss when active and upstream (value) input != output. HOT 2
- Add a simplistic toolbar option HOT 1
- Performance (?)
- `v5.0.0` (awaiting Xcode 14.0)
- Type 'DiffableTextStyle' has no member 'currency' HOT 2
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 diffabletextviews.