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

Cocoapods and swift 1.1 support #10

Merged
merged 3 commits into from Mar 30, 2015

Conversation

asotog
Copy link

@asotog asotog commented Mar 30, 2015

Hi there,

Was able to use swift-validator properly in a project, worked great, but wanted to add it through pods, these pull request lets you use it, configuring the Podfile to something like this (of course after pull request it can be pointed to the main repo)

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "8.1"
use_frameworks!

pod 'Swift-Validator', :git => 'https://github.com/asotog/swift-validator'

Also updated the code to support previous version of swift, swift 1.2 still beta i think so better to still using previous

Thanks in advance

@jpotts18
Copy link
Collaborator

Thanks for the contribution! I have moved swift 1.2 support to a different branch. I'll merge this and maybe you can help me get it into a cocoapod the right way.

jpotts18 added a commit that referenced this pull request Mar 30, 2015
Cocoapods and swift 1.1 support
@jpotts18 jpotts18 merged commit 5c22740 into SwiftValidatorCommunity:master Mar 30, 2015
@asotog
Copy link
Author

asotog commented Mar 30, 2015

np, on Podfile you can explicitly point to particular branch, yep swift 1.2 will be released soon

pod 'Swift-Validator', :git => 'https://github.com/asotog/swift-validator', :branch => 'swift-1.2'

@jpotts18
Copy link
Collaborator

Okay so I just tried to push a new release 2.0.2 with some new changes and Swift 1.1

I updated my Swift-Validator.podspec and ran pod spec lint and I am getting this error.

 -> Swift-Validator (2.0.2)
    - ERROR | [iOS] Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - ERROR | [iOS]  Swift-Validator/Validator/EmailRule.swift:24:16: error: 'NSPredicate?' does not have a member named 'evaluateWithObject'
func validate(value: String) -> Bool {
    return NSPredicate(format: "SELF MATCHES %@", self.REGEX).evaluateWithObject(value)
}

Any ideas?

@asotog
Copy link
Author

asotog commented Mar 30, 2015

i think probably because nspredicate could be undefined have to check first like

       if let emailTest = NSPredicate(format: "SELF MATCHES %@", REGEX) {
            if emailTest.evaluateWithObject(value) {
                return true
            } else {
                return false
            }
        }

@asotog
Copy link
Author

asotog commented Mar 30, 2015

i think pod is looking not the pull request version, you have to tag the code first and then use pod spec lint and update the tag number in the spec file

@asotog
Copy link
Author

asotog commented Mar 31, 2015

also need to add public to all classes, initializers, protocols i can work on that, i was trying a clean project using the pod but it complains about will make that change stay tuned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants