Skip to content

Commit

Permalink
Updated pod to version 2.0 (Swift 3) and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jesster2k10 committed Jul 27, 2017
1 parent 49dd809 commit 8e5077b
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 34 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
116 changes: 96 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
# TKSubmitTransition

[![Platform](http://img.shields.io/badge/platform-ios-blue.svg?style=flat
)](https://developer.apple.com/iphone/index.action)
)](https://developer.apple.com/iphone/index.action)
[![Language](http://img.shields.io/badge/language-swift-brightgreen.svg?style=flat
)](https://developer.apple.com/swift)
)](https://developer.apple.com/swift)
[![License](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat
)](http://mit-license.org)
)](http://mit-license.org)
[![CocoaPods](https://img.shields.io/cocoapods/v/TKSubmitTransition.svg)]()

**Swift2.0!! :cat:**

Inpired by https://dribbble.com/shots/1945593-Login-Home-Screen

Expand All @@ -25,30 +24,83 @@ I made them as classes and you can use it with ease.
![Demo GIF Animation](https://github.com/entotsu/TKSubmitTransition/blob/master/demo.gif "Demo GIF Animation")

# Installation
pod 'TKSubmitTransition'
use_frameworks!

## Cocoapods ##

**Swift 3 / Swift 4**

pod 'TKSubmitTransition'


**Swift 2 & Below**

pod 'TKSubmitTransition'


## Manually ##
Drag all the files from `SubmitTransition/Classes` into your project.

# Usage

## This is SubClass of UIButton
### Storyboard

Just drag a `UIButton` on to your storyboard and change the custom class to `TKSubmitTransition` in the identity inspector.

![Button](http://i.imgur.com/mqSt8y8.png)

Change the settings of the button via the storyboard.

![Settings](http://i.imgur.com/maA1Aiw.png)

Then create an `IBOutlet` to your view controller.

![IBOutlet](http://i.imgur.com/1VK9umA.jpg)

You can now move on to `Animation Method` for further instructions.

### Programatically

You can use `TKTransitionSubmitButton` just like any other `UIButton`. It works practically the same.

Add this at the top of your file:

``` swift
import SubmitTransition
```

Then create a variable above your view did load for the button

``` swift
var bin: TKTransitionSubmitButton!
```

then finally in the view did load add the button

``` swift
btn = TKTransitionSubmitButton(frame: CGRectMake(0, 0, 44, 44))
btn = TKTransitionSubmitButton(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width - 64, height: 44))
btn.center = self.view.center
btn.frame.bottom = self.view.frame.height - 60
btn.setTitle("Sign in", for: UIControlState())
btn.titleLabel?.font = UIFont(name: "HelveticaNeue-Light", size: 14)
self.view.addSubview(btn)
```

## Animation Method

Use this to animate your button. Follow the steps in `Delegation` to setup the transition.

``` swift
func didStartYourLoading() {
btn.startLoadingAnimation()
btn.startLoadingAnimation()
}

func didFinishYourLoading() {
btn.startFinishAnimation {
//Your Transition
let secondVC = SecondViewController()
secondVC.transitioningDelegate = self
self.presentViewController(secondVC, animated: true, completion: nil)
}
btn.startFinishAnimation {
//Your Transition
let secondVC = SecondViewController()
secondVC.transitioningDelegate = self
self.presentViewController(secondVC, animated: true, completion: nil)
}
}

```
Expand All @@ -58,20 +110,44 @@ This Library also supply fade-in Animator Class of `UIViewControllerAnimatedTran

Please use This for transition animation.

### Usage
### Delegation

#### please use UIViewControllerTransitioningDelegate
#### Make sure your class implements the UIViewControllerTransitioningDelegate protocol like so
> class ViewController: UIViewController, UIViewControllerTransitioningDelegate {
#### Setup the transitioning delegate
`secondVC.transitioningDelegate = self`

#### Implement the delegate

**Swift 3/4**

func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return TKFadeInAnimator(transitionDuration: 0.5, startingAlpha: 0.8)
}

func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return nil
}

**Swift 2 & Below**
``` swift
// MARK: UIViewControllerTransitioningDelegate
func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
let fadeInAnimator = TKFadeInAnimator()
return fadeInAnimator
let fadeInAnimator = TKFadeInAnimator()
return fadeInAnimator
}
func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return nil
return nil
}

```

If you need any help with the setup feel free to look at the sample or create an issue.

# Contribution

- If you've found a bug, please open an issue.
- If you've a feature request, please open a pull request
- Please check any closed issues before you open a new one!

26 changes: 14 additions & 12 deletions SubmitTransition/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="15A235d" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" 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="7703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -14,34 +18,32 @@
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kK3-qa-3bd" customClass="TKTransitionSubmitButton" customModule="SubmitTransition" customModuleProvider="target">
<rect key="frame" x="32" y="27" width="536" height="44"/>
<animations/>
<rect key="frame" x="32" y="27" width="311" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="PgQ-MO-Vpx"/>
</constraints>
<state key="normal" title="Submit">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="normalBackgroundColor">
<color key="value" red="0.80000000000000004" green="0.0" blue="0.20205424067083444" alpha="1" colorSpace="calibratedRGB"/>
<color key="value" red="0.80000000000000004" green="0.0" blue="0.20205424067083444" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="highlightedBackgroundColor">
<color key="value" red="0.56159474206349214" green="0.11322686558675865" blue="0.022467013972638509" alpha="1" colorSpace="calibratedRGB"/>
<color key="value" red="0.56159474206349214" green="0.11322686558675865" blue="0.022467013972638509" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="onTapButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="7bQ-Kt-P9v"/>
</connections>
</button>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="kK3-qa-3bd" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="7" id="dey-kk-L5l"/>
<constraint firstAttribute="trailing" secondItem="kK3-qa-3bd" secondAttribute="trailing" constant="32" id="l4h-No-ud1"/>
Expand Down
4 changes: 2 additions & 2 deletions TKSubmitTransition.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "TKSubmitTransition"
s.version = "0.2"
s.version = "2.0"
s.summary = "Animated UIButton of Loading Animation and Transition Animation. Inspired by https://dribbble.com/shots/1945593-Login-Home-Screen"

# s.description = <<-DESC
Expand Down Expand Up @@ -73,7 +73,7 @@ Pod::Spec.new do |s|
# Supports git, hg, bzr, svn and HTTP.
#

s.source = { :git => "https://github.com/entotsu/TKSubmitTransition.git", :tag => "0.2" }
s.source = { :git => "https://github.com/entotsu/TKSubmitTransition.git", :tag => s.version.to_s }


# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
Expand Down

0 comments on commit 8e5077b

Please sign in to comment.