SwiftValidator alternatives and similar libraries
Based on the "UI" category.
Alternatively, view SwiftValidator alternatives based on common mentions on social networks and blogs.
-
Charts
Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart. -
Material
A UI/UX framework for creating beautiful applications. -
folding-cell
:octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion -
Animated Tab Bar
:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion -
LTMorphingLabel
[EXPERIMENTAL] Graceful morphing effects for UILabel written in Swift. -
NVActivityIndicatorView
A collection of awesome loading animations -
FSPagerView
FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders. -
SwiftMessages
A very flexible message bar for iOS written in Swift. -
JTAppleCalendar
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable -
Pagemenu
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram) -
SwipeCellKit
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. -
Alerts Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date... -
TextFieldEffects
Custom UITextFields effects inspired by Codrops, built using Swift -
SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps. -
Macaw
Powerful and easy-to-use vector graphics Swift library with SVG support -
AMScrollingNavbar
Scrollable UINavigationBar that follows the scrolling of a UIScrollView -
Scrollable-GraphView
An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift. -
ImagePicker
:camera: Reinventing the way ImagePicker works. -
PermissionScope
A Periscope-inspired way to ask for iOS permissions. -
SideMenu
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less. -
SPPermission
Universal API for request permission and get its statuses. -
Material Components for iOS
[In maintenance mode] Modular and customizable Material Design UI components for iOS -
SCLAlertView
Beautiful animated Alert View. Written in Swift -
Instructions
Create walkthroughs and guided tours (coach marks) in a simple way, with Swift. -
NotificationBanner
The easiest way to display highly customizable in app notification banners in iOS -
ESTabBarController
:octocat: ESTabBarController is a Swift model for customize UI, badge and adding animation to tabbar items. Support lottie! -
ActiveLabel
UILabel drop-in replacement supporting Hashtags (#), Mentions (@) and URLs (http://) written in Swift -
TLYShyNavBar
Unlike all those arrogant UINavigationBar, this one is shy and humble! Easily create auto-scrolling navigation bars! -
PKHUD
A Swift based reimplementation of the Apple HUD (Volume, Ringer, Rotation,…) for iOS 8. -
SlideMenuControllerSwift
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift. -
Siren
Notify users when a new version of your app is available and prompt them to upgrade. -
PopupDialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style. -
Persei
Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift -
KMNavigationBarTransition
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically. -
StarWars.iOS
This component implements transition animation to crumble view-controller into tiny pieces. -
Whisper
:mega: Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside -
DGElasticPullToRefresh
Elastic pull to refresh for iOS developed in Swift -
Parchment
A paging view controller with a highly customizable menu ✨ -
XLActionController
Fully customizable and extensible action sheet controller written in Swift -
DOFavoriteButton
Cute Animated Button written in Swift. -
PaperOnboarding
:octocat: PaperOnboarding is a material design UI slider. Swift UI library by @Ramotion -
RazzleDazzle
A simple keyframe-based animation framework for iOS, written in Swift. Perfect for scrolling app intros. -
CircleMenu
:octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion
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 SwiftValidator or a related project?
README
SwiftValidator
Swift Validator is a rule-based validation library for Swift.
Core Concepts
UITextField
+[Rule]
+ (and optional errorUILabel
) go intoValidator
UITextField
+ValidationError
come out ofValidator
Validator
evaluates[Rule]
sequentially and stops evaluating when aRule
fails.
Installation
# Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "8.1"
use_frameworks!
# Swift 4.2
pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :tag => '4.2.0'
# Swift 3
# Extended beyond UITextField
pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :branch => 'master'
# Swift 2.1
# Extended beyond UITextField
# Note: Installing 4.x.x will break code from 3.x.x
pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :tag => '4.0.0'
# Swift 2.1 (limited to UITextField validation)
pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :tag => '3.0.5'
Install into your project:
$ pod install
Open your project in Xcode from the .xcworkspace file (not the usual project file):
$ open MyProject.xcworkspace
If you are using Carthage you will need to add this to your Cartfile
github "jpotts18/SwiftValidator"
Usage
You can now import SwiftValidator framework into your files.
Initialize the Validator
by setting a delegate to a View Controller or other object.
// ViewController.swift
let validator = Validator()
Register the fields that you want to validate
override func viewDidLoad() {
super.viewDidLoad()
// Validation Rules are evaluated from left to right.
validator.registerField(fullNameTextField, rules: [RequiredRule(), FullNameRule()])
// You can pass in error labels with your rules
// You can pass in custom error messages to regex rules (such as ZipCodeRule and EmailRule)
validator.registerField(emailTextField, errorLabel: emailErrorLabel, rules: [RequiredRule(), EmailRule(message: "Invalid email")])
// You can validate against other fields using ConfirmRule
validator.registerField(emailConfirmTextField, errorLabel: emailConfirmErrorLabel, rules: [ConfirmationRule(confirmField: emailTextField)])
// You can now pass in regex and length parameters through overloaded contructors
validator.registerField(phoneNumberTextField, errorLabel: phoneNumberErrorLabel, rules: [RequiredRule(), MinLengthRule(length: 9)])
validator.registerField(zipcodeTextField, errorLabel: zipcodeErrorLabel, rules: [RequiredRule(), ZipCodeRule(regex : "\\d{5}")])
// You can unregister a text field if you no longer want to validate it
validator.unregisterField(fullNameTextField)
}
Validate Fields on button tap or however you would like to trigger it.
@IBAction func signupTapped(sender: AnyObject) {
validator.validate(self)
}
Implement the Validation Delegate in your View controller
// ValidationDelegate methods
func validationSuccessful() {
// submit the form
}
func validationFailed(_ errors:[(Validatable ,ValidationError)]) {
// turn the fields to red
for (field, error) in errors {
if let field = field as? UITextField {
field.layer.borderColor = UIColor.red.cgColor
field.layer.borderWidth = 1.0
}
error.errorLabel?.text = error.errorMessage // works if you added labels
error.errorLabel?.isHidden = false
}
}
Single Field Validation
You may use single field validation in some cases. This could be useful in situations such as controlling responders:
// Don't forget to use UITextFieldDelegate
// and delegate yourTextField to self in viewDidLoad()
func textFieldShouldReturn(textField: UITextField) -> Bool {
validator.validateField(textField){ error in
if error == nil {
// Field validation was successful
} else {
// Validation error occurred
}
}
return true
}
Custom Validation
We will create a SSNRule
class to show how to create your own Validation. A United States Social Security Number (or SSN) is a field that consists of XXX-XX-XXXX.
Create a class that inherits from RegexRule
class SSNVRule: RegexRule {
static let regex = "^\\d{3}-\\d{2}-\\d{4}$"
convenience init(message : String = "Not a valid SSN"){
self.init(regex: SSNVRule.regex, message : message)
}
}
Documentation
Checkout the docs here via @jazzydocs.
Credits
Swift Validator is written and maintained by Jeff Potter @jpotts18. David Patterson @dave_tw12 actively works as a collaborator. Special thanks to Deniz Adalar for adding validation beyond UITextField.
Contributing
- 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
- Create a new Pull Request
- Make sure code coverage is at least 70%