Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit 86ef867

Browse files
committed
Make validatable types public
Oops...
1 parent b389589 commit 86ef867

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Library/Core/Validatable.swift

+11-6
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,25 @@
88

99
import Foundation
1010

11-
struct ValidationError: ErrorType, CustomStringConvertible {
12-
let description: String
11+
public struct ValidationError: ErrorType, CustomStringConvertible {
12+
public let description: String
13+
14+
public init(description: String) {
15+
self.description = description
16+
}
1317
}
1418

15-
protocol Validatable {
16-
func validate() throws
19+
/// Validates this entity and throws if it encounters a invalid situation, a validatable should also validate it sub-validatables if it has any. Only things that can't be validated compile time, but result in an invalid situation should be validated
20+
public protocol Validatable {
21+
static func validate() throws
1722
}
1823

1924
extension Validatable {
20-
func assertValid() {
25+
public static func assertValid() {
2126
assert( theRealAssert() )
2227
}
2328

24-
private func theRealAssert() -> Bool {
29+
private static func theRealAssert() -> Bool {
2530
do {
2631
try validate()
2732
} catch {

0 commit comments

Comments
 (0)