{"id":2582,"url":"https://github.com/me-abhinav/NumberMorphView","last_synced_at":"2025-08-03T00:32:05.104Z","repository":{"id":56921131,"uuid":"53822374","full_name":"me-abhinav/NumberMorphView","owner":"me-abhinav","description":"A label view for displaying numbers which can transition or animate using a technique called number tweening or number morphing.","archived":false,"fork":false,"pushed_at":"2017-12-04T04:13:31.000Z","size":4303,"stargazers_count":1583,"open_issues_count":4,"forks_count":120,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-10-29T17:40:26.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/me-abhinav.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":"2016-03-14T02:57:27.000Z","updated_at":"2024-10-22T13:13:41.000Z","dependencies_parsed_at":"2022-08-20T21:50:26.082Z","dependency_job_id":null,"html_url":"https://github.com/me-abhinav/NumberMorphView","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-abhinav%2FNumberMorphView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-abhinav%2FNumberMorphView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-abhinav%2FNumberMorphView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-abhinav%2FNumberMorphView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/me-abhinav","download_url":"https://codeload.github.com/me-abhinav/NumberMorphView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228510739,"owners_count":17931759,"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":[],"created_at":"2024-01-05T20:16:17.515Z","updated_at":"2024-12-06T18:30:36.697Z","avatar_url":"https://github.com/me-abhinav.png","language":"Swift","funding_links":[],"categories":["UI","TextField","Libs","Swift","UI [🔝](#readme)","Content","Other"],"sub_categories":["Label","UI","Other free courses","Mathematics"],"readme":"# NumberMorphView\n\n[![Build Status](https://travis-ci.org/me-abhinav/NumberMorphView.svg?branch=master)](https://travis-ci.org/me-abhinav/NumberMorphView)\n[![Version](https://img.shields.io/cocoapods/v/NumberMorphView.svg?style=flat)](http://cocoapods.org/pods/NumberMorphView)\n[![License](https://img.shields.io/cocoapods/l/NumberMorphView.svg?style=flat)](http://cocoapods.org/pods/NumberMorphView)\n[![Platform](https://img.shields.io/cocoapods/p/NumberMorphView.svg?style=flat)](http://cocoapods.org/pods/NumberMorphView)\n\n`NumberMorphView` a view like label for displaying numbers which animate with transition using a technique called number tweening or number morphing.\n\n\u003cimg src=\"https://raw.githubusercontent.com/me-abhinav/NumberMorphView/dev/sample.gif\" alt=\"alt text\" /\u003e\n\n## Usage\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n### Interface builder\n\n1. Drag a UIView into your view controller.\n2. Change the class to `NumberMorphView` in the identity inspector.\n3. Change intrinsic size from default to placeholder in the size inspector.\n4. Create an IBOutlet in your view controller.\n\nSet the digit of number view as shown below:\n```Swift\nnumberView.currentDigit = 5;\n```\nAnimate to nextDigit as shown below.\n```Swift\nnumberView.nextDigit = 8;\n```\n\n### From code\n\n`NumberMorphView` can be used with or without auto layout. Usage of intrinsic content size is recommended.\nPreferred aspect ratio of the view is 13 : 24.\n\n```Swift\nlet numberView = NumberMorphView();\nnumberView.fontSize = 64;\nnumberView.currentDigit = 5;\nlet preferedSize = numberView.intrinsicContentSize();\nnumberView.frame = CGRect(x: 10, y: 10, width: preferedSize.width, height: preferedSize.height);\nself.view.addSubview(numberView);\n\ndispatch_after(5, dispatch_get_main_queue()) {\n    numberView.nextDigit = 7;\n}\n```\n\nNote: Intrinsic content size is changed after setting `fontSize`.\n\n### Customizing animations\n\n- To set the animation duration:\n```Swift\nnumberView.animationDuration = 4;\n```\n- To change the type of animation, set the interpolator.\n```Swift\nnumberView.interpolator = NumberMorphView.SpringInterpolator();\n```\nAlready available interpolators are `LinearInterpolator`, `OvershootInterpolator`, `SpringInterpolator`, `BounceInterpolator`, `AnticipateOvershootInterpolator`, and `CubicHermiteInterpolator`. Also you can add new interpolators. The interpolator class needs to conform to `InterpolatorProtocol` as shown below:\n```Swift\nclass MyLinearInterpolator: InterpolatorProtocol {\n    func getInterpolation(x: CGFloat) -\u003e CGFloat {\n        return x;\n    }\n}\n```\n\n## Requirements\n\n- iOS 8.0+\n- Swift 2.2\n\n## Installation\n\nNumberMorphView is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\nuse_frameworks!\npod 'NumberMorphView', '0.2.0'\n```\n\n## Author\n\nAbhinav Chauhan\n\n## License\n\nNumberMorphView is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fme-abhinav%2FNumberMorphView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fme-abhinav%2FNumberMorphView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fme-abhinav%2FNumberMorphView/lists"}