Skip to content

Commit

Permalink
- At long last, this closes #17, closes #24, fixes #27 & fixes #37
Browse files Browse the repository at this point in the history
- Introduced an error state for logging errors.
  • Loading branch information
xornorik committed Mar 29, 2020
1 parent c70eb44 commit def2ddf
Show file tree
Hide file tree
Showing 28 changed files with 751 additions and 368 deletions.
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# SVPinView
SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords.

<p align="left">
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/Swift_4-compatible-4BC51D.svg?style=flat" alt="Swift 4 compatible" /></a>
<a href="https://cocoapods.org/pods/ScrollableDatepicker"><img src="https://img.shields.io/badge/pod-2.1.0-blue.svg" alt="CocoaPods compatible" /></a>
<img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" />
<a href="https://raw.githubusercontent.com/maxsokolov/tablekit/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" /></a>
</p>
[![Swift 5.1](https://img.shields.io/badge/Swift-5.1-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/SVPinView.svg)](https://developer.apple.com/swift/)
[![Platforms iOS](https://img.shields.io/badge/Platforms-iOS-lightgray.svg?style=flat)](http://www.apple.com/ios/)
[![License MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat)](https://opensource.org/licenses/MIT)

![demo](SVPinView/Screenshots/SVPinView.gif)

Expand Down Expand Up @@ -65,9 +63,9 @@ The `isContentTypeOneTimeCode` property sets the contentType of the first pinFie
#### Styles
```swift
enum SVPinViewStyle : Int {
case none = 0
case underline
case box
case none = 0
case underline
case box
}
```
There are two inbuilt styes; `underline` & `box`. However, the *fieldBackgroundColor* & *fieldCornerRadius* properties along with *activeFieldBackgroundColor* & *activeCornerRadius* properties can be used to create custom styles.
Expand All @@ -80,20 +78,20 @@ pinView.fieldCornerRadius = 0

- **getPin()**: Returns the entered pin as a String. If the method is called when the pin entry is incomplete, it returns an *empty* String for validation.
- **pastePin()**: Takes a String as an argument and enters it into the pinView. Useful for showing default values or for pasting from clipboard. Long-press on the pin field will also allow pasting from the clipboard.
- **clearPin()**: Clears the entered pin.
- **clearPin()**: Clears the entered pin and also refreshes the view.

### Callbacks

- **didFinishCallback**: Gets executed after the entire pin has been entered. This is useful when a network call has to be made or for navigating to a different ViewController after the pin has been entered.
- **didChangeCallback**: Gets executed when any of the pinFields have been changed. This gives additional control to the parent VC - Eg: if a submit button has to be enabled/disabled based on the pin validation.
```swift
pinView.didFinishCallback = { pin in
print("The pin entered is \(pin)")
pinView.didFinishCallback = { [weak self] pin in
print("The pin entered is \(pin)")
}
```
```swift
pinView.didChangeCallback = { pin in
submitButton.isEnabled = isValid(pin)
pinView.didChangeCallback = { [weak self] pin in
submitButton.isEnabled = isValid(pin)
}
```

Expand Down
3 changes: 2 additions & 1 deletion SVPinView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Pod::Spec.new do |s|

s.name = "SVPinView"
s.version = "1.0.7"
s.version = "1.0.8"
s.summary = "SVPinView is a customisable library used for accepting alphanumeric pins or one-time passwords."

s.homepage = "https://github.com/xornorik/SVPinView"
Expand All @@ -14,6 +14,7 @@ Pod::Spec.new do |s|

s.platform = :ios
s.ios.deployment_target = "9.0"
s.swift_version = '5.0'

s.source = { :git => "https://github.com/xornorik/SVPinView.git", :tag => "#{s.version}" }
s.source_files = "SVPinView/Source/**/*.{swift}"
Expand Down
6 changes: 4 additions & 2 deletions SVPinView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -318,6 +319,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -339,7 +341,7 @@
PRODUCT_BUNDLE_IDENTIFIER = in.svemuri.SVPinView;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -359,7 +361,7 @@
PRODUCT_BUNDLE_IDENTIFIER = in.svemuri.SVPinView;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>SVPinView.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
6 changes: 3 additions & 3 deletions SVPinView/Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- SVPinView (1.0.5)
- SVPinView (1.0.7)

DEPENDENCIES:
- SVPinView (from `../../`)
Expand All @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../../"

SPEC CHECKSUMS:
SVPinView: 7b64d6ae30abbd46e3654bc876770ed07b074b06
SVPinView: 6c1da57e4a1273298802f460c60511ba10f7c831

PODFILE CHECKSUM: b9b57fc0cf7226021a70e6e19e5c127fb3eb5d37

COCOAPODS: 1.5.3
COCOAPODS: 1.8.3
4 changes: 2 additions & 2 deletions SVPinView/Example/Pods/Local Podspecs/SVPinView.podspec.json

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

6 changes: 3 additions & 3 deletions SVPinView/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 def2ddf

Please sign in to comment.