Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JotaMelo committed Jan 6, 2017
1 parent 54c76af commit 353f11c
Show file tree
Hide file tree
Showing 42 changed files with 1,931 additions and 97 deletions.
20 changes: 16 additions & 4 deletions Example/JMMaskTextField.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
18160B83F28995C3CAE5B255 /* Pods-JMMaskTextField_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JMMaskTextField_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-JMMaskTextField_Example/Pods-JMMaskTextField_Example.release.xcconfig"; sourceTree = "<group>"; };
247460C522CF945415AA5021 /* Pods_JMMaskTextField_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JMMaskTextField_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
401BE1C3511B0A1F7ED8379B /* Pods-JMMaskTextField_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JMMaskTextField_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-JMMaskTextField_Tests/Pods-JMMaskTextField_Tests.release.xcconfig"; sourceTree = "<group>"; };
4A653B572D000E57686D318A /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
4A653B572D000E57686D318A /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
607FACD01AFB9204008FA782 /* JMMaskTextField_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JMMaskTextField_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -44,9 +44,9 @@
607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
945882128EEAF985308707CF /* Pods_JMMaskTextField_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JMMaskTextField_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
964F50B58B959374ED03B556 /* Pods-JMMaskTextField_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JMMaskTextField_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-JMMaskTextField_Example/Pods-JMMaskTextField_Example.debug.xcconfig"; sourceTree = "<group>"; };
B0B19D301D7A1FD41A2C5380 /* JMMaskTextField.podspec */ = {isa = PBXFileReference; includeInIndex = 1; name = JMMaskTextField.podspec; path = ../JMMaskTextField.podspec; sourceTree = "<group>"; };
B0B19D301D7A1FD41A2C5380 /* JMMaskTextField-Swift.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = "JMMaskTextField-Swift.podspec"; path = "../JMMaskTextField-Swift.podspec"; sourceTree = "<group>"; };
E4B6EB4E3904CA3F0D36528B /* Pods-JMMaskTextField_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JMMaskTextField_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-JMMaskTextField_Tests/Pods-JMMaskTextField_Tests.debug.xcconfig"; sourceTree = "<group>"; };
F8171FA29F1A2D1416306E2C /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; name = README.md; path = ../README.md; sourceTree = "<group>"; };
F8171FA29F1A2D1416306E2C /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -152,7 +152,7 @@
607FACF51AFB993E008FA782 /* Podspec Metadata */ = {
isa = PBXGroup;
children = (
B0B19D301D7A1FD41A2C5380 /* JMMaskTextField.podspec */,
B0B19D301D7A1FD41A2C5380 /* JMMaskTextField-Swift.podspec */,
F8171FA29F1A2D1416306E2C /* README.md */,
4A653B572D000E57686D318A /* LICENSE */,
);
Expand Down Expand Up @@ -489,11 +489,13 @@
baseConfigurationReference = 964F50B58B959374ED03B556 /* Pods-JMMaskTextField_Example.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = JMMaskTextField/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -502,18 +504,22 @@
baseConfigurationReference = 18160B83F28995C3CAE5B255 /* Pods-JMMaskTextField_Example.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = JMMaskTextField/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
607FACF31AFB9204008FA782 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = E4B6EB4E3904CA3F0D36528B /* Pods-JMMaskTextField_Tests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -526,13 +532,17 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JMMaskTextField_Example.app/JMMaskTextField_Example";
};
name = Debug;
};
607FACF41AFB9204008FA782 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 401BE1C3511B0A1F7ED8379B /* Pods-JMMaskTextField_Tests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -541,6 +551,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JMMaskTextField_Example.app/JMMaskTextField_Example";
};
name = Release;
};
Expand Down
10 changes: 10 additions & 0 deletions Example/JMMaskTextField.xcworkspace/contents.xcworkspacedata

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

10 changes: 6 additions & 4 deletions Example/JMMaskTextField/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="NO">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<deployment identifier="iOS"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
Expand All @@ -24,7 +26,7 @@
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
Expand Down
32 changes: 27 additions & 5 deletions Example/JMMaskTextField/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="NO" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<deployment identifier="iOS"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="JMMaskTextField_Example" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="6fL-e8-UvH" customClass="JMMaskTextField" customModule="JMMaskTextField">
<rect key="frame" x="16" y="40" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="maskString" value="(00) 0000-0000"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="delegate" destination="vXZ-lx-hvc" id="PN7-sj-O1D"/>
</connections>
</textField>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="6fL-e8-UvH" secondAttribute="trailing" id="77C-sl-jFK"/>
<constraint firstItem="6fL-e8-UvH" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="HT0-TL-dPN"/>
<constraint firstItem="6fL-e8-UvH" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" constant="20" id="cLX-1k-D4K"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
Expand Down
31 changes: 19 additions & 12 deletions Example/JMMaskTextField/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,25 @@
//

import UIKit
import JMMaskTextField

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
class ViewController: UIViewController, UITextFieldDelegate {

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {

guard let text = textField.text as NSString? else { return true }
let newText = text.replacingCharacters(in: range, with: string)

let maskTextField = textField as! JMMaskTextField
guard let unmaskedText = maskTextField.stringMask?.unmask(string: newText) else { return true }

if unmaskedText.characters.count >= 11 {
maskTextField.maskString = "(00) 0 0000-0000"
} else {
maskTextField.maskString = "(00) 0000-0000"
}

return true
}

}

16 changes: 16 additions & 0 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PODS:
- JMMaskTextField (0.1.0)

DEPENDENCIES:
- JMMaskTextField (from `../`)

EXTERNAL SOURCES:
JMMaskTextField:
:path: "../"

SPEC CHECKSUMS:
JMMaskTextField: e7e33ace619da1a5612b67ea89aa0d61110cbde1

PODFILE CHECKSUM: 20ce40da8eecb62c232aa8df30134c359d5ae79f

COCOAPODS: 1.1.1
22 changes: 22 additions & 0 deletions Example/Pods/Local Podspecs/JMMaskTextField.podspec.json

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

16 changes: 16 additions & 0 deletions Example/Pods/Manifest.lock

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

Loading

0 comments on commit 353f11c

Please sign in to comment.