Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Package Manager support #229

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
language: objective-c
osx_image: xcode10.1
xcode_sdk: iphonesimulator10.0
osx_image: xcode11
xcode_sdk: iphonesimulator11.0.1
xcode_project: Validator.xcodeproj
xcode_scheme: Validator

before_install:
- gem install cocoapods -v '0.32.1'
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-document --quiet

script:
- xcodebuild clean build test -project Validator.xcodeproj -scheme Validator -sdk iphonesimulator -destination "platform=iOS Simulator,OS=10.0,name=iPhone 6" -enableCodeCoverage YES CODE_SIGNING_REQUIRED=NO | xcpretty
- xcodebuild clean build test -project Validator.xcodeproj -scheme Validator -sdk iphonesimulator -destination "platform=iOS Simulator,OS=11.0.1,name=iPhone 6" -enableCodeCoverage YES CODE_SIGNING_REQUIRED=NO | xcpretty
- pod lib lint
after_success:

Expand Down
29 changes: 29 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SwiftValidator",
platforms: [.iOS(.v8)],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "SwiftValidator",
targets: ["SwiftValidator"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "SwiftValidator",
dependencies: []),
.testTarget(
name: "SwiftValidatorTests",
dependencies: ["SwiftValidator"]),
]
)
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ If you are using Carthage you will need to add this to your `Cartfile`
github "jpotts18/SwiftValidator"
```

If you are using Swift Package Manager you need to add this to your dependencies.

```bash
https://github.com/SwiftValidatorCommunity/SwiftValidator
```

## Usage

You can now import SwiftValidator framework into your files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 jpotts18. All rights reserved.
//

import Foundation
import UIKit

public typealias ValidatableField = AnyObject & Validatable

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright (c) 2015 jpotts18. All rights reserved.
//

#import <UIKit/UIKit.h>
@import Foundation;

//! Project version number for SwiftValidator.
FOUNDATION_EXPORT double SwiftValidatorVersionNumber;
Expand Down
1 change: 1 addition & 0 deletions Sources/SwiftValidator/SwiftValidator.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let version = "5.1.0"
6 changes: 3 additions & 3 deletions SwiftValidator.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "SwiftValidator"
s.version = "4.0.0"
s.swift_version = "4.2"
s.version = "5.1.0"
s.swift_version = "5.3"
s.summary = "A UITextField Validation library for Swift"
s.homepage = "https://github.com/jpotts18/SwiftValidator"
s.screenshots = "https://raw.githubusercontent.com/jpotts18/SwiftValidator/master/swift-validator-v2.gif"
Expand All @@ -11,7 +11,7 @@ Pod::Spec.new do |s|
s.platform = :ios
s.ios.deployment_target = '8.0'
s.source = { :git => "https://github.com/jpotts18/SwiftValidator.git", :tag => "4.0.0" }
s.source_files = "SwiftValidator/**/*.swift"
s.source_files = "Sources/**/*.swift"
s.exclude_files = "Validator/AppDelegate.swift"
s.frameworks = ['Foundation', 'UIKit']
s.requires_arc = true
Expand Down
4 changes: 4 additions & 0 deletions Tests/SwiftValidatorTests-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

import UIKit
import XCTest
import Validator // example app
import SwiftValidator // framework

class SwiftValidatorTests: XCTestCase {

Expand All @@ -34,7 +32,7 @@ class SwiftValidatorTests: XCTestCase {
let VALID_CARD_EXPIRY_MONTH = "10"
let INVALID_CARD_EXPIRY_MONTH = "13"

let VALID_CARD_EXPIRY_YEAR = "2018"
let VALID_CARD_EXPIRY_YEAR = "2021"
let INVALID_CARD_EXPIRY_YEAR = "2016"

let LEN_3 = "hey"
Expand Down Expand Up @@ -407,7 +405,7 @@ class SwiftValidatorTests: XCTestCase {
}
REGISTER_TXT_FIELD.text = INVALID_EMAIL
REGISTER_VALIDATOR.validateField(REGISTER_TXT_FIELD) { error in
XCTAssert(error?.errorMessage.characters.count ?? 0 > 0, "Should state 'invalid email'")
XCTAssert(error?.errorMessage.count ?? 0 > 0, "Should state 'invalid email'")
}
}

Expand Down
9 changes: 9 additions & 0 deletions Tests/SwiftValidatorTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(SwiftValidatorTests.allTests),
]
}
#endif
Loading