diff --git a/Example/NSString-Helper.xcodeproj/project.pbxproj b/Example/NSString-Helper.xcodeproj/project.pbxproj index bb682d0..9bd3587 100644 --- a/Example/NSString-Helper.xcodeproj/project.pbxproj +++ b/Example/NSString-Helper.xcodeproj/project.pbxproj @@ -37,7 +37,7 @@ /* Begin PBXFileReference section */ 1DD359B387438B2D4450388A /* Pods_NSString_Helper_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NSString_Helper_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 6003F58A195388D20070C39A /* NSString-Helper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = "NSString-Helper.app"; path = "NSString-Helper_Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 6003F58A195388D20070C39A /* NSString-Helper_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "NSString-Helper_Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; @@ -50,7 +50,7 @@ 6003F5A5195388D20070C39A /* NSStringHelperViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSStringHelperViewController.h; sourceTree = ""; }; 6003F5A6195388D20070C39A /* NSStringHelperViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSStringHelperViewController.m; sourceTree = ""; }; 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 6003F5AE195388D20070C39A /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = Tests.xctest; path = "NSString-Helper_Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 6003F5AE195388D20070C39A /* NSString-Helper_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "NSString-Helper_Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -108,8 +108,8 @@ 6003F58B195388D20070C39A /* Products */ = { isa = PBXGroup; children = ( - 6003F58A195388D20070C39A /* NSString-Helper.app */, - 6003F5AE195388D20070C39A /* Tests.xctest */, + 6003F58A195388D20070C39A /* NSString-Helper_Example.app */, + 6003F5AE195388D20070C39A /* NSString-Helper_Tests.xctest */, ); name = Products; sourceTree = ""; @@ -213,7 +213,7 @@ ); name = "NSString-Helper_Example"; productName = "NSString-Helper"; - productReference = 6003F58A195388D20070C39A /* NSString-Helper.app */; + productReference = 6003F58A195388D20070C39A /* NSString-Helper_Example.app */; productType = "com.apple.product-type.application"; }; 6003F5AD195388D20070C39A /* NSString-Helper_Tests */ = { @@ -234,7 +234,7 @@ ); name = "NSString-Helper_Tests"; productName = "NSString-HelperTests"; - productReference = 6003F5AE195388D20070C39A /* Tests.xctest */; + productReference = 6003F5AE195388D20070C39A /* NSString-Helper_Tests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ diff --git a/Example/NSString-Helper/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/NSString-Helper/Images.xcassets/AppIcon.appiconset/Contents.json index f697f61..b7f3352 100644 --- a/Example/NSString-Helper/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/NSString-Helper/Images.xcassets/AppIcon.appiconset/Contents.json @@ -15,6 +15,11 @@ "size" : "60x60", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -50,4 +55,4 @@ "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/NSString-Helper.podspec b/NSString-Helper.podspec index e9907d9..abec2a0 100644 --- a/NSString-Helper.podspec +++ b/NSString-Helper.podspec @@ -1,28 +1,13 @@ -# -# Be sure to run `pod lib lint NSString-Helper.podspec' to ensure this is a -# valid spec and remove all comments before submitting the spec. -# -# Any lines starting with a # are optional, but encouraged -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html -# - Pod::Spec.new do |s| s.name = "NSString-Helper" s.version = "0.1.0" - s.summary = "A short description of NSString-Helper." - s.description = <<-DESC - An optional longer description of NSString-Helper - - * Markdown format. - * Don't worry about the indent, we strip it! - DESC - s.homepage = "https://github.com//NSString-Helper" - # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" + s.summary = "NSString-Helper is usefull helper to validate email NSSString" + s.homepage = "https://github.com/giuseppenucifora/NSString-Helper" + # s.screenshots = "" s.license = 'MIT' s.author = { "Giuseppe Nucifora" => "me@giuseppenucifora.com" } - s.source = { :git => "https://github.com//NSString-Helper.git", :tag => s.version.to_s } - # s.social_media_url = 'https://twitter.com/' + s.source = { :git => "https://github.com/giuseppenucifora/NSString-Helper.git", :tag => s.version.to_s } + # s.social_media_url = 'https://twitter.com/giuseppenuc' s.platform = :ios, '7.0' s.requires_arc = true diff --git a/Pod/Classes/NSString+Helper.h b/Pod/Classes/NSString+Helper.h new file mode 100644 index 0000000..beb1bec --- /dev/null +++ b/Pod/Classes/NSString+Helper.h @@ -0,0 +1,15 @@ +// +// NSString+Helper.h +// +// +// Created by Giuseppe Nucifora on 02/07/15. +// Copyright (c) 2015 Giuseppe Nucifora All rights reserved. +// + +#import + +@interface NSString (Helper) + +- (BOOL) validateEmail; + +@end diff --git a/Pod/Classes/NSString+Helper.m b/Pod/Classes/NSString+Helper.m new file mode 100644 index 0000000..e501d62 --- /dev/null +++ b/Pod/Classes/NSString+Helper.m @@ -0,0 +1,23 @@ +// +// NSString+Helper.m +// +// +// Created by Giuseppe Nucifora on 02/07/15. +// Copyright (c) 2015 Giuseppe Nucifora All rights reserved. +// + +#import "NSString+Helper.h" + +@implementation NSString (Helper) + +- (BOOL) validateEmail +{ + BOOL stricterFilter = YES; + NSString *stricterFilterString = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; + NSString *laxString = @".+@.+\\.[A-Za-z]{2}[A-Za-z]*"; + NSString *emailRegex = stricterFilter ? stricterFilterString : laxString; + NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; + return [emailTest evaluateWithObject:self]; +} + +@end