Honour alternatives and similar libraries
Based on the "Utility" category.
Alternatively, view Honour alternatives based on common mentions on social networks and blogs.
-
SwifterSwift
A handy collection of more than 500 native Swift extensions to boost your productivity. -
SwiftGen
The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs! -
SwiftGen-Storyboard
The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs! -
R.swift
Strong typed, autocompleted resources like images, fonts and segues in Swift projects -
Dollar
A functional tool-belt for Swift Language similar to Lo-Dash or Underscore.js in Javascript -
swift-protobuf
Plugin and runtime library for using protobuf with Swift -
EZSwiftExtensions
:smirk: How Swift standard types and classes were supposed to work. -
DifferenceKit
💻 A fast and flexible O(n) difference algorithm framework for Swift collection. -
Result
Swift type modelling the success/failure of arbitrary operations. -
DeepDiff
🦀Amazingly incredible extraordinary lightning fast diffing in Swift -
Device
Light weight tool for detecting the current device and screen size written in swift. -
SwiftLinkPreview
It makes a preview from an URL, grabbing all the information such as title, relevant texts and images. -
WhatsNew
Showcase new features after an app update similar to Pages, Numbers and Keynote. -
Codextended
Extensions giving Swift's Codable API type inference super powers 🦸♂️🦹♀️ -
SwiftyJSONAccelerator
macOS app to generate Swift 5 code for models from JSON (with Codeable) -
Playbook
📘A library for isolated developing UI components and automatically taking snapshots of them. -
ReadabilityKit
Preview extractor for news, articles and full-texts in Swift -
ObjectiveKit
Swift-friendly API for a set of powerful Objective C runtime functions. -
Compass
:earth_africa: Compass helps you setup a central navigation system for your application -
Bow
🏹 Bow is a cross-platform library for Typed Functional Programming in Swift -
Pythonic.swift
Pythonic tool-belt for Swift – a Swift implementation of selected parts of Python standard library. -
Prototope
Swift library of lightweight interfaces for prototyping, bridged to JS.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Honour or a related project?
Popular Comparisons
README
Honour
Validation library for iOS inspired by Respect/Validation.
Validator.mustBe(Uppercase()).andMust(StartsWith("F")).validate("FOOBAR")
:exclamation: If you want to use this library in Objective-C classes, check HonourBridge repo.
Usage
Single Validation
let username = "jeanpimentel"
Lowercase().validate(username) // true
Chained Validation
It is possible to use validators in a chain.
let v = Validator.addRule(Lowercase()).addRule(NoWhitespace()).addRule(Length(min: 3, max: 60))
v.validate("jeanpimentel") // true
Syntax sugar
It is possible to use some syntax tricks to be highly expressive.
let v = Validator.mustHave(Length(min: 3, max: 60)).and(NoWhitespace()).andMustBe(Lowercase())
v.validate("jeanpimentel") // true
Granularity control
We have 3 validation methods
validate()
- returns true or falseassert()
- returns a tuple with true/false and all errors, if any.check()
- returns a tuple with true/false and the first error, if any.
Validate
func validate(value: AnyObject) -> Bool
let validator = Validator().addRule(Uppercase()).addRule(StartsWith("J"))
validator.validate("JEAN") // true
validator.validate("PIMENTEL") // false
Assert
func assert(value: AnyObject) -> (isValid: Bool, invalidRules: Array<Rule>)
let validator = Validator().addRule(Uppercase()).addRule(StartsWith("J"))
let result = validator.assert("JEAN")
result.isValid // true
result.invalidRules // [] (empty)
let result = validator.assert("Jean")
result.isValid // false
result.invalidRules // [Uppercase()]
let result = validator.assert("Felipe")
result.isValid // false
result.invalidRules // [Uppercase(), StartsWith("J")]
Check
func check(value: AnyObject) -> (isValid: Bool, invalidRule: Rule?)
let validator = Validator().addRule(Uppercase()).addRule(StartsWith("J"))
let result = validator.check("JEAN")
result.isValid // true
result.invalidRule // nil
let result = validator.check("Felipe")
result.isValid // false
result.invalidRule // Uppercase()
let result = validator.check("FELIPE")
result.isValid // false
result.invalidRule // StartsWith("J")
Installation
Package is available on CocoaPods. See the "Using CocoaPods" guide for more information.
use_frameworks!
platform :ios, '7.0'
pod 'Honour', '~> 1.1.1'
Requirements
Honour Version | Minimum iOS Target | Notes |
---|---|---|
1.1.1 | iOS 7 | Swift 1.2 (Xcode 6.3) is required. |
Contributing
If you found a bug, and can provide steps to reliably reproduce it, open an issue.
If you have a feature request, open an issue.
If you want to contribute, submit a pull request.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
Validators
Always a working in progress...
Available now:
- [AllOf](HonourTests/Library/Rules/AllOfTest.swift)
- [AlwaysInvalid](HonourTests/Library/Rules/AlwaysInvalidTest.swift)
- [AlwaysValid](HonourTests/Library/Rules/AlwaysValidTest.swift)
- [Between](HonourTests/Library/Rules/BetweenTest.swift)
- [Composite](HonourTests/Library/Rules/CompositeTest.swift)
- [Contains](HonourTests/Library/Rules/ContainsTest.swift)
- [CountryCode](HonourTests/Library/Rules/CountryCodeTest.swift)
- [Email](HonourTests/Library/Rules/EmailTest.swift)
- [EndsWith](HonourTests/Library/Rules/EndsWithTest.swift)
- [Even](HonourTests/Library/Rules/EvenTest.swift)
- [HexRGBColor](HonourTests/Library/Rules/HexRGBColorTest.swift)
- [Length](HonourTests/Library/Rules/LengthTest.swift)
- [Lowercase](HonourTests/Library/Rules/LowercaseTest.swift)
- [Max](HonourTests/Library/Rules/MaxTest.swift)
- [Min](HonourTests/Library/Rules/MinTest.swift)
- [Negative](HonourTests/Library/Rules/NegativeTest.swift)
- [NoWhitespace](HonourTests/Library/Rules/NoWhitespaceTest.swift)
- [NoneOf](HonourTests/Library/Rules/NoneOfTest.swift)
- [NotEmpty](HonourTests/Library/Rules/NotEmptyTest.swift)
- [Odd](HonourTests/Library/Rules/OddTest.swift)
- [OneOf](HonourTests/Library/Rules/OneOfTest.swift)
- [Positive](HonourTests/Library/Rules/PositiveTest.swift)
- [Regex](HonourTests/Library/Rules/RegexTest.swift)
- [Roman](HonourTests/Library/Rules/RomanTest.swift)
- [StartsWith](HonourTests/Library/Rules/StartsWithTest.swift)
- [Uppercase](HonourTests/Library/Rules/UppercaseTest.swift)
- [Version](HonourTests/Library/Rules/VersionTest.swift)
Localized validators
- Brazil (BR)
- [CPF](HonourTests/Library/Rules/Locale/BR/CPFTest.swift)
License
Honour is released under the MIT license. See [LICENSE](LICENSE) for details.
*Note that all licence references and agreements mentioned in the Honour README section above
are relevant to that project's source code only.