Skip to content

Commit

Permalink
Merge pull request #18 from simformsolutions/develop
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
simform-solutions authored Nov 12, 2018
2 parents 2005d75 + 6181ffe commit 9d5212d
Show file tree
Hide file tree
Showing 7 changed files with 209 additions and 81 deletions.
2 changes: 1 addition & 1 deletion SSSpinnerButton.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "SSSpinnerButton"
s.version = "1.1.1"
s.version = "1.1.2"
s.summary = "SSSpinnerButton is an elegant button with a different spinner animations."

#s.description = "SSSpinnerButton is an elegant button with a different spinner animations."
Expand Down
11 changes: 8 additions & 3 deletions SSSpinnerButton/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="30" translatesAutoresizingMaskIntoConstraints="NO" id="L6t-dE-3h7">
<rect key="frame" x="0.0" y="0.0" width="135" height="360"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UW4-Lx-QHw" customClass="SSSpinnerButton" customModule="SSSpinnerButton" customModuleProvider="target">
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UW4-Lx-QHw" customClass="SSSpinnerButton" customModule="SSSpinnerButton" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="135" height="40"/>
<color key="backgroundColor" red="0.97647058823529409" green="0.58039215686274503" blue="0.6470588235294118" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
Expand All @@ -33,6 +33,11 @@
<state key="normal" title="BallClipRotate">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornrRadius">
<real key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="onSpinnnerButtonClick:" destination="BYZ-38-t0r" eventType="touchUpInside" id="WSs-Ty-TWf"/>
</connections>
Expand Down Expand Up @@ -95,7 +100,7 @@
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="30" translatesAutoresizingMaskIntoConstraints="NO" id="WvR-h8-XhK">
<rect key="frame" x="145" y="0.0" width="135" height="360"/>
<subviews>
<button opaque="NO" tag="5" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="e7v-OB-5yI" customClass="SSSpinnerButton" customModule="SSSpinnerButton" customModuleProvider="target">
<button opaque="NO" clipsSubviews="YES" tag="5" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="e7v-OB-5yI" customClass="SSSpinnerButton" customModule="SSSpinnerButton" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="135" height="40"/>
<color key="backgroundColor" red="0.97647058819999999" green="0.58039215690000001" blue="0.64705882349999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
Expand Down Expand Up @@ -184,7 +189,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="111" y="24"/>
<point key="canvasLocation" x="699" y="22"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ protocol SSSpinnerAnimationDelegate {
/// - color: color of spinner
/// - spinnerSize: size of spinner layer
func setupSpinnerAnimation(layer: CALayer, frame: CGRect, color: UIColor, spinnerSize: UInt?)

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,28 @@ class SSErrorMark: SSSpinnerAnimationDelegate {
// add layer
let errorMark = CheckMarkShape.errorMark.layerWith(frame: frame, color: color)
layer.addSublayer(errorMark)

// end status
let strokeEnd: CGFloat = 10
errorMark.strokeEnd = strokeEnd

// animation
let animation = CABasicAnimation(keyPath: "strokeEnd")
animation.duration = 2.0
animation.fromValue = 0.0
animation.toValue = strokeEnd
errorMark.add(animation, forKey: nil)
animation.isRemovedOnCompletion = true
errorMark.add(animation, forKey: animation.keyPath)

// shake animation
let anim = CABasicAnimation(keyPath: "transform.rotation.z")
anim.fromValue = (-Double.pi / 10)
anim.toValue = (Double.pi / 10)
anim.duration = 0.05
anim.duration = 0.08
anim.repeatCount = 4
anim.autoreverses = true
layer.add(anim, forKey: nil)
anim.isRemovedOnCompletion = true
layer.add(anim, forKey: anim.keyPath)
}

}
42 changes: 26 additions & 16 deletions SSSpinnerButton/SSSpinnerButton/SpinerShapes/SpinnerTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,40 +50,50 @@ public enum SpinnerType: Int {
- returns: Instance of SSCircleStrokeSpin.
*/
case circleStrokeSpin

/// Animation of spinner
///
/// - Returns:
func animation() -> SSSpinnerAnimationDelegate {
switch self {
case .ballClipRotate:
return SSSpinnerBallClipRotate()
case .ballSpinFade:
return SSBallSpinFadeLoader()
case .lineSpinFade:
return SSLineSpinFadeLoader()
case .ballRotateChase:
return SSBallRotateChase()
case .circleStrokeSpin:
return SSCircleStrokeSpin()

}
}

}

public enum SpinnerCompletionType: Int {
/**
CircleStrokeSpin.
CheckMark.

- returns: Instance of SSCheckMark.
*/
case checkMark
/**
CircleStrokeSpin.
FailMark.

- returns: Instance of SSFailMark.
*/
case failMark
/**
CircleStrokeSpin.
ErrorMark.

- returns: Instance of SSErrorMark.
*/
case errorMark

/// Animation of spinner
///
/// - Returns:
func animation() -> SSSpinnerAnimationDelegate {
switch self {
case .ballClipRotate:
return SSSpinnerBallClipRotate()
case .ballSpinFade:
return SSBallSpinFadeLoader()
case .lineSpinFade:
return SSLineSpinFadeLoader()
case .ballRotateChase:
return SSBallRotateChase()
case .circleStrokeSpin:
return SSCircleStrokeSpin()
case .checkMark:
return SSSuccessMark()
case .failMark:
Expand Down
Loading

0 comments on commit 9d5212d

Please sign in to comment.