{"id":13990753,"url":"https://github.com/takuoka/TKSubmitTransition","last_synced_at":"2025-07-22T13:31:20.929Z","repository":{"id":36050698,"uuid":"40348516","full_name":"takuoka/TKSubmitTransition","owner":"takuoka","description":"Animated UIButton of Loading Animation and Transition Animation. Inspired by  https://dribbble.com/shots/1945593-Login-Home-Screen","archived":false,"fork":false,"pushed_at":"2019-12-04T12:29:02.000Z","size":10731,"stargazers_count":2274,"open_issues_count":9,"forks_count":226,"subscribers_count":43,"default_branch":"master","last_synced_at":"2024-04-14T04:27:55.701Z","etag":null,"topics":["animation","library","swift","transition-animation"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takuoka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-07T07:56:58.000Z","updated_at":"2024-04-03T01:48:43.000Z","dependencies_parsed_at":"2022-09-01T18:52:05.555Z","dependency_job_id":null,"html_url":"https://github.com/takuoka/TKSubmitTransition","commit_stats":null,"previous_names":["entotsu/tksubmittransition"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuoka%2FTKSubmitTransition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuoka%2FTKSubmitTransition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuoka%2FTKSubmitTransition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuoka%2FTKSubmitTransition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takuoka","download_url":"https://codeload.github.com/takuoka/TKSubmitTransition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":214668598,"owners_count":15767199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","library","swift","transition-animation"],"created_at":"2024-08-09T13:03:11.116Z","updated_at":"2024-08-09T13:11:19.665Z","avatar_url":"https://github.com/takuoka.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"\n# TKSubmitTransition\n\n[![Platform](http://img.shields.io/badge/platform-ios-blue.svg?style=flat\n             )](https://developer.apple.com/iphone/index.action)\n[![Language](http://img.shields.io/badge/language-swift-brightgreen.svg?style=flat\n             )](https://developer.apple.com/swift)\n[![License](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat\n            )](http://mit-license.org)\n[![CocoaPods](https://img.shields.io/cocoapods/v/TKSubmitTransition.svg)]()\n\n\nInpired by https://dribbble.com/shots/1945593-Login-Home-Screen\n\nI created Animated UIButton of Loading Animation and Transition Animation.\n\nAs you can see in the GIF Animation Demo below, you can find the “Sign in” button rolling and after that, next UIViewController will fade-in. \n\nI made them as classes and you can use it with ease.\n\n[Objective-C version is here.](https://github.com/wwdc14/HySubmitTransitionObjective-C)\n\n# Demo\n![Demo GIF Animation](https://github.com/entotsu/TKSubmitTransition/blob/master/demo.gif \"Demo GIF Animation\")\n\n# Installation\n\n## Cocoapods ##\n\n**Swift 5**\n\n``` ruby\npod 'TKSubmitTransition', :git =\u003e 'https://github.com/entotsu/TKSubmitTransition.git'\n```\n\n**Swift 4**\n\n``` ruby\npod 'TKSubmitTransition', :git =\u003e 'https://github.com/entotsu/TKSubmitTransition.git', :branch =\u003e 'swift4'\n```\n\n**Swift 3** \n\n``` ruby\npod 'TKSubmitTransition', :git =\u003e 'https://github.com/entotsu/TKSubmitTransition.git', :tag =\u003e '2.0'\n```\n\n\n**Swift 2 \u0026 Below** \n\n``` ruby\npod 'TKSubmitTransition', '~\u003e 0.2' \n```\n\n\n## Manually ##\nDrag all the files from `SubmitTransition/Classes` into your project.\n\n# Usage\n\n### Storyboard\n\nJust drag a `UIButton` on to your storyboard and change the custom class to `TKSubmitTransition` in the identity inspector.\n\n![Button](http://i.imgur.com/mqSt8y8.png)\n\nChange the settings of the button via the storyboard.\n\n![Settings](http://i.imgur.com/maA1Aiw.png)\n\nThen create an `IBOutlet` to your view controller.\n\n![IBOutlet](http://i.imgur.com/1VK9umA.jpg)\n\nYou can now move on to `Animation Method` for further instructions.\n\n### Programatically\n\nYou can use `TKTransitionSubmitButton` just like any other `UIButton`. It works practically the same.\n\nAdd this at the top of your file:\n\n``` swift\nimport SubmitTransition\n```\n\nThen create a variable above your view did load for the button\n\n``` swift\nvar bin: TKTransitionSubmitButton!\n```\n\nthen finally in the view did load add the button\n\n``` swift\nbtn = TKTransitionSubmitButton(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width - 64, height: 44))\nbtn.center = self.view.center\nbtn.frame.bottom = self.view.frame.height - 60\nbtn.setTitle(\"Sign in\", for: UIControlState())\nbtn.titleLabel?.font = UIFont(name: \"HelveticaNeue-Light\", size: 14)\nself.view.addSubview(btn)\n```\n\n## Animation Method\n\nUse this to animate your button. Follow the steps in `Delegation` to setup the transition.\n\n``` swift\nfunc didStartYourLoading() {\n  btn.startLoadingAnimation()\n}\n\nfunc didFinishYourLoading() {\n  btn.startFinishAnimation {\n    //Your Transition\n    let secondVC = SecondViewController()\n    secondVC.transitioningDelegate = self\n    self.presentViewController(secondVC, animated: true, completion: nil)\n  }\n}\n\n```\n\n## Networking\n\nIf you are running requests to a server and are waiting a responce, you can use something like this to stop and start the animation:\n\n``` swift\n// start loading the button animations\nbutton.startLoadingAnimation()\n\n// run query in background thread\nasync.background {\n  let query = PFQuery(className: \"Blah\")\n  query.whereKey(\"user\", equalTo: user)\n\tlet results = try! query.findObjects()\n  \n\tif results.count == 0 {\n\t\t// insert alertView telling user that their details don't work\n\t}\n\telse {\n\t\t// return to main thread to complete login\n\t\tasync.main {\n                        // tell the button to finish its animations\n\t\t\tbutton.startFinishingAnimation(1) {\n\t\t\t        let sb = UIStoryboard(name: \"Main\", bundle: nil)\n\t            \t        let vc = sb.instantiateViewController(withIdentifier: \"MainVC\")\n\t\t\t        vc.transitioningDelegate = self\n\t\t\t        self.present(vc, animated: true, completion: nil)\n                        }\n\t\t}\n\t}\n```\nThanks to [@sarfrazb](https://github.com/sarfrazb) for pointing this out.\n\n## TKFadeInAnimator\nThis Library also supply fade-in Animator Class of `UIViewControllerAnimatedTransitioning`.\n\nPlease use This for transition animation.\n\n### Delegation\n\n#### Make sure your class implements the UIViewControllerTransitioningDelegate protocol like so\n\u003e class ViewController: UIViewController, UIViewControllerTransitioningDelegate {\n\n#### Setup the transitioning delegate\n`secondVC.transitioningDelegate = self`\n\n#### Implement the delegate\n\n**Swift 3/4**\n\n``` swift\nfunc animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -\u003e UIViewControllerAnimatedTransitioning? {\n  return TKFadeInAnimator(transitionDuration: 0.5, startingAlpha: 0.8)\n}\n\nfunc animationController(forDismissed dismissed: UIViewController) -\u003e UIViewControllerAnimatedTransitioning? {\n  return nil\n}\n```\n\n**Swift 2 \u0026 Below**\n\n``` swift\n// MARK: UIViewControllerTransitioningDelegate\nfunc animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -\u003e UIViewControllerAnimatedTransitioning? {\n  let fadeInAnimator = TKFadeInAnimator()\n  return fadeInAnimator\n}\n\nfunc animationControllerForDismissedController(dismissed: UIViewController) -\u003e UIViewControllerAnimatedTransitioning? {\n  return nil\n}\n\n```\n\nIf you need any help with the setup feel free to look at the sample or create an issue.\n\n# Contribution\n\n- If you've found a bug, please open an issue.\n- If you've a feature request, please open a pull request\n- Please check any closed issues before you open a new one!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuoka%2FTKSubmitTransition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakuoka%2FTKSubmitTransition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuoka%2FTKSubmitTransition/lists"}