Skip to content
This repository was archived by the owner on Jul 3, 2019. It is now read-only.

Commit cc098ee

Browse files
committed
Merge branch 'release/0.1.0'
2 parents f8ed3bf + bb1c24c commit cc098ee

24 files changed

+517
-51
lines changed

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ DerivedData
4545
# We recommend against adding the Pods directory to your .gitignore. However
4646
# you should judge for yourself, the pros and cons are mentioned at:
4747
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
48-
#
49-
# Pods/
48+
49+
Pods/
5050

5151
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode
5252

@@ -104,4 +104,8 @@ fastlane/build
104104
## Covers Carthage
105105

106106
Carthage/Checkouts
107-
Carthage/Build
107+
Carthage/Build
108+
109+
## Covers Swift Package
110+
111+
.build

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0

.travis.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ env:
44
global:
55
- LC_CTYPE=en_US.UTF-8
66
- LANG=en_US.UTF-8
7-
- PROJECT=framework/ValidationComponents.xcodeproj
7+
- PROJECT=ValidationComponents.xcodeproj
88
- IOS_FRAMEWORK_SCHEME="ValidationComponents iOS"
99
- OSX_FRAMEWORK_SCHEME="ValidationComponents macOS"
1010
- TVOS_FRAMEWORK_SCHEME="ValidationComponents tvOS"
@@ -14,23 +14,28 @@ env:
1414
- TVOS_SDK=appletvsimulator10.0
1515
- WATCHOS_SDK=watchsimulator3.0
1616
matrix:
17-
- DESTINATION="OS=10.0,name=iPhone 6S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" CONFIGURATION="Debug" RUN_TESTS="NO"
18-
- DESTINATION="arch=x86_64" SCHEME="$OSX_FRAMEWORK_SCHEME" SDK="$MACOS_SDK" CONFIGURATION="Debug" RUN_TESTS="NO"
19-
- DESTINATION="OS=10.0,name=Apple TV 1080p" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK" CONFIGURATION="Debug" RUN_TESTS="YES"
20-
- DESTINATION="OS=3.0,name=Apple Watch - 42mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="$WATCHOS_SDK" CONFIGURATION="Debug" RUN_TESTS="NO"
17+
- DESTINATION="OS=10.0,name=iPhone 6S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" CONFIGURATION="Debug" RUN_TESTS="NO" POD_LINT="NO"
18+
- DESTINATION="arch=x86_64" SCHEME="$OSX_FRAMEWORK_SCHEME" SDK="$MACOS_SDK" CONFIGURATION="Debug" RUN_TESTS="NO" POD_LINT="NO"
19+
- DESTINATION="OS=10.0,name=Apple TV 1080p" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK" CONFIGURATION="Debug" RUN_TESTS="YES" POD_LINT="YES"
20+
- DESTINATION="OS=3.0,name=Apple Watch - 42mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="$WATCHOS_SDK" CONFIGURATION="Debug" RUN_TESTS="NO" POD_LINT="NO"
2121

2222
before_install:
2323
- brew update
2424
- brew outdated carthage || brew upgrade carthage
25-
- gem install xcpretty
25+
- gem install xcpretty --pre --no-rdoc --no-ri --no-document --quiet
26+
- gem install cocoapods --pre --no-rdoc --no-ri --no-document --quiet
2627

2728
script:
2829
- set -o pipefail
30+
- carthage update
2931
- if [ $RUN_TESTS == "YES" ]; then
3032
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration "$CONFIGURATION" ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty -c;
3133
else
3234
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration "$CONFIGURATION" ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
3335
fi
36+
- if [ $POD_LINT == "YES" ]; then
37+
pod lib lint --quick;
38+
fi
3439

3540
after_success:
3641
- if [ $RUN_TESTS == "YES" ]; then

Cartfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github "alexcristea/validation-kit" "develop"

Cartfile.resolved

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github "alexcristea/validation-kit" "6569766d422fa7dc664222915c8b96adb08e61fb"

Package.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import PackageDescription
2+
3+
let package = Package(
4+
name: "ValidationComponents",
5+
dependencies: [
6+
.Package(url: "https://github.com/nsagora/validation-kit.git", majorVersion: 0)
7+
],
8+
exclude: ["Tests"]
9+
)

Packages/ValidationKit-0.2.0

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 2f84cf511800da21d30b3b9c74b655c7ebf4aa24

README.md

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,57 @@
1-
# Validation Components [![travis-status]][travis-overview] [![codecov-status]][codecov-overview] [![carthage-compatible]][carthage-overview] [![license]][license-overview]
1+
[Validation Kit][validation-kit] · __Validation Components__
2+
3+
[validation-kit]: https://github.com/nsagora/validation-kit
4+
[validation-components]: https://github.com/nsagora/validation-components
5+
6+
-------
7+
8+
# Validation Components
9+
[![travis-status]][travis-overview] [![codecov-status]][codecov-overview] [![carthage-compatible]][carthage-overview] [![license]][license-overview] [![twitter]][twitter-overview]
10+
11+
[twitter]: https://img.shields.io/badge/twitter-%40nsgaora-blue.svg?style=flat
12+
[twitter-overview]: https://twitter.com/nsagora
213

3-
Components Catalog for extending the Validation Kit framework.
414

515
[license]: https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat
616
[license-overview]: http://choosealicense.com/licenses/apache-2.0/
717

8-
[travis-status]: https://travis-ci.org/alexcristea/validation-components.svg?branch=develop
9-
[travis-overview]: https://travis-ci.org/alexcristea/validation-components
18+
[travis-status]: https://travis-ci.org/nsagora/validation-components.svg?branch=develop
19+
[travis-overview]: https://travis-ci.org/nsagora/validation-components
1020

11-
[codecov-status]: https://codecov.io/gh/alexcristea/validation-components/branch/develop/graph/badge.svg
12-
[codecov-overview]: https://codecov.io/gh/alexcristea/validation-components
21+
[codecov-status]: https://codecov.io/gh/nsagora/validation-components/branch/develop/graph/badge.svg
22+
[codecov-overview]: https://codecov.io/gh/nsagora/validation-components
1323

1424
[carthage-compatible]: https://img.shields.io/badge/carthage-compatible-4BC51D.svg?style=flat
15-
[carthage-overview]: https://github.com/Carthage/Carthage
25+
[carthage-overview]: https://github.com/Carthage/Carthage
26+
27+
## Introduction
28+
29+
`Validation Components` extends the [`Validation Kit`][validation-kit] framework by offering a collection of common validation predicates that most of the projects can benefit of.
30+
31+
## Installation
32+
33+
### Carthage
34+
35+
To use the latest stable version, add this to your [`Cartfile`][carthage-cartfile]:
36+
37+
```
38+
github "nsagora/validation-components"
39+
```
40+
41+
To use a certain version, add this to your [`Cartfile`][carthage-cartfile]:
42+
43+
```
44+
github "nsagora/validation-components" >= 0.1.0
45+
```
46+
47+
To use the latest version in development, add this to your [`Cartfile`][carthage-cartfile]:
48+
49+
```
50+
github "nsagora/validation-components" "develop"
51+
```
52+
53+
The full documentation on how to install and use [Carthage][carthage] is available on their official github [page][carthage].
54+
55+
[carthage]: https://github.com/Carthage/Carthage
56+
[carthage-cartfile]: https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile
57+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// EmailValidationPredicate.swift
3+
// Validator
4+
//
5+
// Created by Alex Cristea on 07/08/16.
6+
// Copyright © 2016 iOS NSAgora. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import ValidationKit
11+
12+
public struct EmailValidationPredicate: ValidationPredicate {
13+
14+
private let rule: RegexValidationPredicate
15+
private let regex = "(?:[\\p{L}0-9!#$%\\&'*+/=?\\^_`{|}~-]+(?:\\.[\\p{L}0-9!#$%\\&'*+/=?\\^_`{|}" +
16+
"~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\" +
17+
"x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[\\p{L}0-9](?:[a-" +
18+
"z0-9-]*[\\p{L}0-9])?\\.)+[\\p{L}0-9](?:[\\p{L}0-9-]*[\\p{L}0-9])?|\\[(?:(?:25[0-5" +
19+
"]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-" +
20+
"9][0-9]?|[\\p{L}0-9-]*[\\p{L}0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21" +
21+
"-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"
22+
23+
public init() {
24+
rule = RegexValidationPredicate(expression: regex)
25+
}
26+
27+
public func evaluate(with input: String?) -> Bool {
28+
29+
guard let _ = input else { return false }
30+
return rule.evaluate(with: input)
31+
}
32+
}

framework/Sources/Info.plist renamed to Sources/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.0</string>
18+
<string>0.1.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

0 commit comments

Comments
 (0)