eurekacommunity / genericpasswordrow Goto Github PK
View Code? Open in Web Editor NEWA row for Eureka to implement password validations.
License: MIT License
A row for Eureka to implement password validations.
License: MIT License
It would be great if this can be updated to 4.1
What's the best practice to do it?
I found that I have to write a subclass MyGenericPasswordCell
of GenericPasswordCell
and override the togglePasswordVisibility
method. After that, I have to write a MyGenericPasswordRow
, _GenericPasswordRow
. The Eureka framework is not friendly to add new row type.
Actually, I just make visibilityButton
public, and replace the target action.
Hey, it would be great if the pod spec could require Eureka 4+
. I'll look into submitting a PR for that.
Hello,
I wanted to integrate GenericPasswordRow to my project, but cocoapods
displays this message :
`[!] CocoaPods could not find compatible versions for pod "Eureka":
In snapshot (Podfile.lock):
Eureka (= 5.2.1, ~> 5.0)
In Podfile:
Eureka
GenericPasswordRow was resolved to 1.0.0, which depends on
Eureka (~> 1.7)
`
Could you please update the project to the latest Eureka framework version 5.2.1 please ?
I cannot update myself, because I'm a beginner.
Thank you in advance.
There are few issues when building against Swift 4.2
The title is pretty descriptive, but the issue is pretty easy to reproduce, just create a GenericPasswordRow with a customized password validator. When you try to type the password and it's long enough to fill the width of the field, main thread gets stuck, see traceback and screenshots below:
Form:
<<< GenericPasswordRow("user_password"){
row in
row.passwordValidator = CustomPasswordValidator()
row.placeholder = NSLocalizedString("Password", comment: "Password")
let passwordValidation = RuleClosure<String> { rowValue in
return ((rowValue == nil) || !(self.form.values()["user_mail"] as? String == rowValue.value)) ? ValidationError(msg: NSLocalizedString("Wrong Password", comment: "Wrong Password Mail")) : nil
}
row.add(rule: passwordValidation)
}
Validator:
class CustomPasswordValidator: PasswordValidator {
fileprivate struct PasswordRule {
let hint: String
let test: (String) -> Bool
}
open let maxStrength = 5.0
fileprivate let rules: [PasswordRule] = [
PasswordRule(hint: "Please enter a lowercase letter") { $0.satisfiesRegexp("[a-z]") },
PasswordRule(hint: "Please enter a number or a special character") { $0.satisfiesRegexp("(?=.*([0-9]|[^\\w]))") },
PasswordRule(hint: "Please enter an uppercase letter") { $0.satisfiesRegexp("[A-Z]") },
PasswordRule(hint: "At least 8 characters") { $0.characters.count > 7 },
PasswordRule(hint: "No more than two consecutive repeating characters or numbers") { $0.satisfiesRegexp("^(?!.*(.)\\1{1})") }
]
internal func strengthForPassword(_ password: String) -> Double {
return rules.reduce(0) { $0 + ($1.test(password) ? 1 : 0) }
}
internal func hintForPassword(_ password: String) -> String? {
return rules.reduce([]) { $0 + ($1.test(password) ? []: [$1.hint]) }.first
}
internal func isPasswordValid(_ password: String) -> Bool {
return rules.reduce(true) { $0 && $1.test(password) }
}
internal func colorsForStrengths() -> [Double: UIColor] {
return [
0: UIColor(red: 244 / 255, green: 67 / 255, blue: 54 / 255, alpha: 1),
1: UIColor(red: 255 / 255, green: 193 / 255, blue: 7 / 255, alpha: 1),
2: UIColor(red: 3 / 255, green: 169 / 255, blue: 244 / 255, alpha: 1),
3: UIColor(red: 153 / 255, green: 255 / 255, blue: 153 / 255, alpha: 1),
4: UIColor(red: 139 / 255, green: 195 / 255, blue: 74 / 255, alpha: 1)
]
}
}
extension String {
func satisfiesRegexp(_ regexp: String) -> Bool {
return range(of: regexp, options: .regularExpression) != nil
}
}
Stuck at:
Here!
P.D.: Commenting out both beginUpdates()
and endUpdates()
do not fix the issue, getting stuck at an unknown traceable point of execution.
EDIT: It seems that something that I can't properly debug allocates (after 30 seconds of blocking the Main Thread as I described) up to 1GB of RAM before getting:
Message from debugger: Terminated due to memory issue
Hello guys :)
I notice that GenericPasswordCell inherit from _FieldCell,to take advantage of keyboard handle(eg: automatic keyboard‘s expand/collapse and return button with Eureka)
I also notice in GenericPasswordCell.xib,The only textField instead of bind with GenericPasswordCell,it bind with textField in _FieldCell.How to do that???
I try do the same (bind my textField to _FieldCell in IB),but can not be successful!
How can I bind textField in my custom Cell to take advantage of keyboard handle from _FieldCell class???
thanks a lot!
Hello everyone ;)
I post the Q in stack stackoverflow at here :
Can anyone help me??? Thanks a lot.
Q details:
I write a custom Row , and Row's value is this :
struct CountUnit:Equatable,InputTypeInitiable{
var totalCount:Int
var unit:String
init?(string stringValue: String) {
//...
}
static func ==(lhs: CountUnit, rhs: CountUnit) -> Bool {
//...
}
}
What I ask is that : How to let Eureka invoke onChange() event on any of CountUnit's instance value changed???(totalCount and unit) :
<<< CountUnitRow() {row in
//do some init...
}.onChange {row in
//how to let user know value was changed
}
Thanks a lot ;)
I am getting this error on iOS 12:
'Could not load NIB in bundle: 'NSBundle </var/containers/Bundle/Application/F0AAD157-7E76-4F0C-9ED2-336FDC1D0092/FamClub.app> (loaded)' with name 'GenericPasswordCell''
It seems like something in this framweork has broken or is not supported in iOS 12.
Anyone else experiencing this?
The eureka framework cannot be found when I download this project. can you fix that.
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.