Skip to content

Commit def2ddf

Browse files
committed
- At long last, this closes #17, closes #24, fixes #27 & fixes #37
- Introduced an error state for logging errors.
1 parent c70eb44 commit def2ddf

File tree

28 files changed

+751
-368
lines changed

28 files changed

+751
-368
lines changed

.swift-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# SVPinView
22
SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords.
33

4-
<p align="left">
5-
<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>
6-
<a href="https://cocoapods.org/pods/ScrollableDatepicker"><img src="https://img.shields.io/badge/pod-2.1.0-blue.svg" alt="CocoaPods compatible" /></a>
7-
<img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" />
8-
<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>
9-
</p>
4+
[![Swift 5.1](https://img.shields.io/badge/Swift-5.1-orange.svg?style=flat)](https://developer.apple.com/swift/)
5+
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/SVPinView.svg)](https://developer.apple.com/swift/)
6+
[![Platforms iOS](https://img.shields.io/badge/Platforms-iOS-lightgray.svg?style=flat)](http://www.apple.com/ios/)
7+
[![License MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat)](https://opensource.org/licenses/MIT)
108

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

@@ -65,9 +63,9 @@ The `isContentTypeOneTimeCode` property sets the contentType of the first pinFie
6563
#### Styles
6664
```swift
6765
enum SVPinViewStyle : Int {
68-
case none = 0
69-
case underline
70-
case box
66+
case none = 0
67+
case underline
68+
case box
7169
}
7270
```
7371
There are two inbuilt styes; `underline` & `box`. However, the *fieldBackgroundColor* & *fieldCornerRadius* properties along with *activeFieldBackgroundColor* & *activeCornerRadius* properties can be used to create custom styles.
@@ -80,20 +78,20 @@ pinView.fieldCornerRadius = 0
8078

8179
- **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.
8280
- **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.
83-
- **clearPin()**: Clears the entered pin.
81+
- **clearPin()**: Clears the entered pin and also refreshes the view.
8482

8583
### Callbacks
8684

8785
- **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.
8886
- **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.
8987
```swift
90-
pinView.didFinishCallback = { pin in
91-
print("The pin entered is \(pin)")
88+
pinView.didFinishCallback = { [weak self] pin in
89+
print("The pin entered is \(pin)")
9290
}
9391
```
9492
```swift
95-
pinView.didChangeCallback = { pin in
96-
submitButton.isEnabled = isValid(pin)
93+
pinView.didChangeCallback = { [weak self] pin in
94+
submitButton.isEnabled = isValid(pin)
9795
}
9896
```
9997

SVPinView.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Pod::Spec.new do |s|
33

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

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

1515
s.platform = :ios
1616
s.ios.deployment_target = "9.0"
17+
s.swift_version = '5.0'
1718

1819
s.source = { :git => "https://github.com/xornorik/SVPinView.git", :tag => "#{s.version}" }
1920
s.source_files = "SVPinView/Source/**/*.{swift}"

SVPinView.xcodeproj/project.pbxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@
264264
SDKROOT = iphoneos;
265265
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
266266
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
267+
SWIFT_VERSION = 5.0;
267268
VERSIONING_SYSTEM = "apple-generic";
268269
VERSION_INFO_PREFIX = "";
269270
};
@@ -318,6 +319,7 @@
318319
MTL_ENABLE_DEBUG_INFO = NO;
319320
SDKROOT = iphoneos;
320321
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
322+
SWIFT_VERSION = 5.0;
321323
VALIDATE_PRODUCT = YES;
322324
VERSIONING_SYSTEM = "apple-generic";
323325
VERSION_INFO_PREFIX = "";
@@ -339,7 +341,7 @@
339341
PRODUCT_BUNDLE_IDENTIFIER = in.svemuri.SVPinView;
340342
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
341343
SKIP_INSTALL = YES;
342-
SWIFT_VERSION = 4.2;
344+
SWIFT_VERSION = 5.0;
343345
TARGETED_DEVICE_FAMILY = "1,2";
344346
};
345347
name = Debug;
@@ -359,7 +361,7 @@
359361
PRODUCT_BUNDLE_IDENTIFIER = in.svemuri.SVPinView;
360362
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
361363
SKIP_INSTALL = YES;
362-
SWIFT_VERSION = 4.2;
364+
SWIFT_VERSION = 5.0;
363365
TARGETED_DEVICE_FAMILY = "1,2";
364366
};
365367
name = Release;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>SVPinView.xcscheme_^#shared#^_</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
</dict>
14+
</plist>

SVPinView/Example/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- SVPinView (1.0.5)
2+
- SVPinView (1.0.7)
33

44
DEPENDENCIES:
55
- SVPinView (from `../../`)
@@ -9,8 +9,8 @@ EXTERNAL SOURCES:
99
:path: "../../"
1010

1111
SPEC CHECKSUMS:
12-
SVPinView: 7b64d6ae30abbd46e3654bc876770ed07b074b06
12+
SVPinView: 6c1da57e4a1273298802f460c60511ba10f7c831
1313

1414
PODFILE CHECKSUM: b9b57fc0cf7226021a70e6e19e5c127fb3eb5d37
1515

16-
COCOAPODS: 1.5.3
16+
COCOAPODS: 1.8.3

SVPinView/Example/Pods/Local Podspecs/SVPinView.podspec.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SVPinView/Example/Pods/Manifest.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)