marinofelipe / currencytext Goto Github PK
View Code? Open in Web Editor NEWCurrency text field formatter available for UIKit and SwiftUI πΆβοΈ
License: MIT License
Currency text field formatter available for UIKit and SwiftUI πΆβοΈ
License: MIT License
Improve clarity on the Example app.
The idea is to showcase users how a different currency formatter setup affect the text field input formatting.
e.g. adding pickers to change both currency and locale
Idea from @CGKarnlund on #59
The project sample does not have a sample. believe me!
Besides the tests the sample shows how to use the cocoa pod.
No dependencies and/or references by now.
The lib API is not friendly and readable as it should be.
To customize currency the user has to set the number formatter locale, as an example.
Review and improves all properties, interfaces, functions and set ups to add an easy to use interface with a great documentation.
No dependencies and/or references by now.
The pod could have fastlane and ci integrations.
Repetitive work would be automated lowering chances of failures.
No dependencies and/or references by now.
Luckily there is a uiTextField callback provided and I can set it up by doing this, but it's very ugly
textFieldConfiguration: { uiTextField in
DispatchQueue.main.async {
if !becomeFirstResponderCalled {
uiTextField.becomeFirstResponder()
}
becomeFirstResponderCalled = true
}
}
If we can use it with https://developer.apple.com/documentation/swiftui/link/focused(_:)?changes=latest_minor, then great~~
Actually, I want to input $10 instead of $10.0 and I have to add a floating point anytime. Now if I click 1, it starts from 0.1, then I should click 0 to get $1.0
Travis build could be improved. This would also bring great new CI advanced knowledges.
... π
No dependencies and/or references by now.
support Carthage
...
...
None.
We canβt delete characters on TextField on iOS 13 on physical device.On simulator it is ok.
I tested on two device : XS Max , 8.
Awesome Library
The decimal place is recognized as values e.g
1,200.00 is interpreted as 120000 which is wrong. Can there be a fix to this please
Released and stable dependency that provides API for CurrencyText functionality in SwiftUI.
It's not possible for users to add negative values.
The lib does not work when setting fraction digits to zero.
Fix this bug and support formatting without decimal values.
This bug was discovered by myanalysis. Thanks π
The framework does not allow to define min and max values.
What would be really nice and friendly.
Improve the usage
...
...
When the CurrencyTextFieldDelegate is constructed with a formatter that hasDecimals = true
and minValue
as an integer (e.g. 1), the first inserted number is not taken into account, and the field text gets formatted to the min value. This happens because the first inserted number would be the last decimal number, which is less than the min value.
0.05
< 1.00
.
Make the CI more reliable.
Behavior can be seen on #59
Now that SPM is integrated with Xcode 11, add support for it.
Drives the framework to the future of dependency management in Apple OS's.
No dependencies and/or references by now.
The pod could have lanes to:
Repetitive work would be automated lowering chances of failures.
No dependencies and/or references by now.
Auto clears only removes zeroed values.
Improves auto clears with custom options.
No dependencies and/or references by now.
The repo does not have a contribution guideline file
unit tests for non tested string extension funcs and cursor positioning
No dependencies and/or references by now.
Now that this framework works apart from text field subclassing and acts as a currency text field mask formatter, should not it become a full text field mask framework?
Allows this framework to be more helpful for those who needs text field masks π !
No dependencies and/or references by now.
Whenever Apple provides us with API for fully controlling TextField
s selected text range, it will open the door for a plain vanilla SwiftUI version of CurrencyTextField
and its libraries.
As additional benefits all TextField
modifiers will work nicely with CurrencyTextField
, and support for all platforms will be possible given that importing UIKit
won't be needed anymore.
Let's see what WWDC and the next iteration of SwiftUI
will give us π€ !
Apple ππ
As reported:
The starting cursor positioning code hasn't been working for us when we fill the text field with a formatted currency string so the user can edit it. Under this condition, when the user taps the field the initial cursor position is forced to be somewhere in the middle of the string. So something similar to this "$123,|456".
Setup to reproduce the issue:
$0.minValue = 1
$0.currency = .dollar
$0.locale = CurrencyLocale.englishUnitedStates
$0.maxValue = 100000000
Text entered in the filed: 12345678
Reported by @CGKarnlund on #59
The functionality provided by CurrencyText should be available not only on UIKit, but also on SwiftUI.
I imagine CurrencyFormatter
can still be used, but a separate library must be created to support using a currency formatter along with SwiftUI's TextField.
There are mutliple warnings on iOS >16.X while using your code:
Publishing changes from within view updates is not allowed, this will cause undefined behavior.
File: CurrencyText/tree/main/Sources
Lines: 73, 122 and 124
There will be no more warnings while running the app. Improve stability.
TBD
No dependencies and/or references by now.
If the CurrencyFormatter
currency
value is changed and re-rendered, the CurrencyTextField
does not update with the new currency value.
Example:
struct SomeView: View {
@State var currency: String
@State var text: String
@State var unformatted: String?
@State var input: Double?
var body: some View {
Picker("Currency", selection: $currency) {
ForEach(["EUR", "GBP", "USD"], id: \.self) { currency in
Text(currency)
}
}
CurrencyTextField(
configuration: .init(
placeholder: "0",
text: $text,
unformattedText: $unformatted,
inputAmount: $input,
formatter: CurrencyFormatter {
// HERE the View is not updated when `$currency` changes
$0.currency = Currency(rawValue: currency)!
},
textFieldConfiguration: { uiTextField in
// β¦
}
)
)
}
}
It would allow to dynamically change the currency of the CurrencyTextField
TBD
No dependencies and/or references by now.
Update automated tests with a larger variety of currency formatter + text field delegate setups.
This intends to (among other things) improve the reliability of the project for different "formatting" cases.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.