Skip to content

Commit

Permalink
PinCodeControl => Fix rendering in IB. Added possibility of configure…
Browse files Browse the repository at this point in the history
… appearance (while private). Move standard states to preset static variables. Added comments.

QUIckControl => Fix bug with change state in action block.
  • Loading branch information
k-o-d-e-n committed Feb 12, 2017
1 parent 2d18ce3 commit bc6c082
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 92 deletions.
4 changes: 3 additions & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use_frameworks!

target 'QUIckControlExample' do
pod 'PinCodeControl' # loaded all depended pods (QUIckControl, Statable)
# pod 'PinCodeControl' # loaded all depended pods (QUIckControl, Statable)
pod 'PinCodeControl', :path => '../'
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
config.build_settings['CONFIGURATION_BUILD_DIR'] = '$PODS_CONFIGURATION_BUILD_DIR'
end
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -30,6 +40,16 @@
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down Expand Up @@ -59,6 +79,11 @@
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
Expand Down
10 changes: 5 additions & 5 deletions Example/QUIckControlExample/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -36,7 +36,7 @@
<constraint firstAttribute="width" constant="149" id="qtX-wK-zMS"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="spaceBetweenItems">
<userDefinedRuntimeAttribute type="number" keyPath="spaceSize">
<real key="value" value="13"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="sideSize">
Expand All @@ -60,7 +60,7 @@
<constraint firstAttribute="height" constant="33" id="lGM-B2-t6M"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="spaceBetweenItems">
<userDefinedRuntimeAttribute type="number" keyPath="spaceSize">
<real key="value" value="13"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="sideSize">
Expand All @@ -84,7 +84,7 @@
<constraint firstAttribute="height" constant="33" id="XyL-EG-IKs"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="spaceBetweenItems">
<userDefinedRuntimeAttribute type="number" keyPath="spaceSize">
<real key="value" value="13"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="sideSize">
Expand Down
6 changes: 4 additions & 2 deletions Example/QUIckControlExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import UIKit
import PinCodeControl
import QUIckControl
import Statable

struct PinCodeElementsGroup {
weak var control: PinCodeControl!
Expand Down Expand Up @@ -60,11 +61,12 @@ class ViewController: UIViewController {
oldGroup.addDependencyFor(group: newGroup)
newGroup.addDependencyFor(group: repeatGroup)
repeatGroup.addDependencyFor(button: applyButton)

applyButton.addTarget(self, action: #selector(touchUpInside(sender:)), for: .touchUpInside)

// newPinCodeControl.itemPath = UIBezierPath(rect: CGRect(origin: .zero, size: CGSize(width: 35, height: 35)))
// oldPinCodeControl.itemPath = UIBezierPath(roundedRect: CGRect(origin: .zero, size: CGSize(width: 20, height: 20)), byRoundingCorners: [.bottomLeft, .topRight], cornerRadii: CGSize(width: 10, height: 10))
newPinCodeControl.subscribe(on: .typeComplete) { print($0) }.start()
repeatGroup.control.validationBlock = { (code: String) -> Bool in return code == self.newGroup.control.code }
repeatGroup.control.validator = BlockPredicate<String>() { $0 == self.newGroup.control.code }

oldGroup.control.setValue("Old PIN-code is invalid",
forTarget: self,
Expand Down
Loading

0 comments on commit bc6c082

Please sign in to comment.