Skip to content

Commit

Permalink
Merge pull request #39 from 3lvis/fix/importing-framework
Browse files Browse the repository at this point in the history
Fix importing framework
  • Loading branch information
3lvis authored Oct 23, 2017
2 parents 5062339 + e429656 commit 550997d
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 79 deletions.
7 changes: 3 additions & 4 deletions Custom/Controller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Controller: UIViewController {
textField.placeholder = "Email"

var validation = Validation()
validation.required = true
validation.minimumLength = 1
validation.format = "[\\w._%+-]+@[\\w.-]+\\.\\w{2,}"
let inputValidator = InputValidator(validation: validation)
textField.inputValidator = inputValidator
Expand All @@ -32,7 +32,6 @@ class Controller: UIViewController {
var validation = Validation()
validation.maximumLength = "1234 5678 1234 5678".characters.count
validation.minimumLength = "1234 5678 1234 5678".characters.count
validation.required = true
let characterSet = NSMutableCharacterSet.decimalDigit()
characterSet.addCharacters(in: " ")
validation.characterSet = characterSet as CharacterSet
Expand All @@ -53,7 +52,7 @@ class Controller: UIViewController {
textField.placeholder = "Expiration Date (MM/YY)"

var validation = Validation()
validation.required = true
validation.minimumLength = 1
let inputValidator = CardExpirationDateInputValidator(validation: validation)
textField.inputValidator = inputValidator

Expand Down Expand Up @@ -115,7 +114,7 @@ class Controller: UIViewController {
view.addSubview(payButton)
}

func payAction() {
@objc func payAction() {
let validEmail = emailField.validate()
let validCardNumber = cardNumberField.validate()
let validCardExpirationDate = cardExpirationDateField.validate()
Expand Down
122 changes: 61 additions & 61 deletions Demo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Native/Controller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Controller: UITableViewController {
}
}

func done() {
@objc func done() {
let alertController = UIAlertController(title: "The payment details are valid", message: nil, preferredStyle: .alert)
let dismissAction = UIAlertAction(title: "Dismiss", style: .default, handler: nil)
alertController.addAction(dismissAction)
Expand Down
7 changes: 3 additions & 4 deletions Native/Field.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ struct Field {
items.append(Field(type: .header, title: "Cardholder"))

var requiredValidation = Validation()
requiredValidation.required = true
requiredValidation.minimumLength = 1
let requiredInputValidator = InputValidator(validation: requiredValidation)

let emailField: Field = {
var field = Field(type: .field, title: "Email")
field.inputType = .email

var validation = Validation()
validation.required = true
validation.minimumLength = 1
validation.format = "[\\w._%+-]+@[\\w.-]+\\.\\w{2,}"
field.inputValidator = InputValidator(validation: validation)

Expand All @@ -59,7 +59,6 @@ struct Field {
var validation = Validation()
validation.minimumLength = "1234 5678 1234 5678".characters.count
validation.maximumLength = "1234 5678 1234 5678".characters.count
validation.required = true
let characterSet = NSMutableCharacterSet.decimalDigit()
characterSet.addCharacters(in: " ")
validation.characterSet = characterSet as CharacterSet
Expand All @@ -75,7 +74,7 @@ struct Field {
field.formatter = CardExpirationDateFormatter()
field.inputType = .integer
var validation = Validation()
validation.required = true
validation.minimumLength = 1
let inputValidator = CardExpirationDateInputValidator(validation: validation)
field.inputValidator = inputValidator

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import XCTest
import FormTextField

class CardExpirationDateFormatterTests: XCTestCase {
func testFormatString() {
Expand Down
1 change: 1 addition & 0 deletions Tests/FormatterTests/CardNumberFormatterTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import XCTest
import FormTextField

class CardNumberFormatterTests: XCTestCase {
func testFormatString() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import XCTest
import Foundation
import FormTextField

class CardExpirationDateInputValidatorTests: XCTestCase {
func testCardExpirationDate() {
Expand Down
1 change: 1 addition & 0 deletions Tests/InputValidatorTests/DecimalInputValidatorTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import XCTest
import FormTextField

class DecimalInputValidatorTests: XCTestCase {
func testDecimal() {
Expand Down
1 change: 1 addition & 0 deletions Tests/InputValidatorTests/InputValidatableTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import XCTest
import Foundation
import FormTextField

class InputValidatableTests: XCTestCase {
func testComposedStringStrings() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import XCTest
import Foundation
import FormTextField

class RequiredInputValidatorTests: XCTestCase {
func testValidation() {
Expand Down
9 changes: 0 additions & 9 deletions Tests/Tests.swift

This file was deleted.

1 change: 1 addition & 0 deletions Tests/ValidationTests/ValidationTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import UIKit
import XCTest
import FormTextField

class ValidationTests: XCTestCase {
func testEmptyValidation() {
Expand Down

0 comments on commit 550997d

Please sign in to comment.