26 lines
460 B
Swift
26 lines
460 B
Swift
//
|
|
// Required.swift
|
|
// pyur-ios
|
|
//
|
|
// Created by Jeff Potter on 12/22/14.
|
|
// Copyright (c) 2015 jpotts18. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public class RequiredRule: Rule {
|
|
|
|
public init(){}
|
|
|
|
var message: String {
|
|
return "This field is required"
|
|
}
|
|
|
|
public func validate(value: String) -> Bool {
|
|
return !value.isEmpty
|
|
}
|
|
|
|
public func errorMessage() -> String {
|
|
return message
|
|
}
|
|
} |