{"id":20945162,"url":"https://github.com/tbxark/tkdotsegment","last_synced_at":"2026-03-10T05:03:41.572Z","repository":{"id":56922975,"uuid":"55966336","full_name":"TBXark/TKDotSegment","owner":"TBXark","description":"TKDotSegment is a segment with dot animation","archived":false,"fork":false,"pushed_at":"2017-09-23T18:31:48.000Z","size":91,"stargazers_count":104,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-19T17:56:03.962Z","etag":null,"topics":["carthage","cocoapods","ios-animation","segment","swift","widget"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":false,"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/TBXark.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-04-11T11:22:10.000Z","updated_at":"2025-04-26T12:07:03.000Z","dependencies_parsed_at":"2022-08-21T05:20:20.701Z","dependency_job_id":null,"html_url":"https://github.com/TBXark/TKDotSegment","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/TBXark/TKDotSegment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TBXark%2FTKDotSegment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TBXark%2FTKDotSegment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TBXark%2FTKDotSegment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TBXark%2FTKDotSegment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TBXark","download_url":"https://codeload.github.com/TBXark/TKDotSegment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TBXark%2FTKDotSegment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275225866,"owners_count":25427000,"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","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["carthage","cocoapods","ios-animation","segment","swift","widget"],"created_at":"2024-11-18T23:46:59.553Z","updated_at":"2026-03-10T05:03:41.503Z","avatar_url":"https://github.com/TBXark.png","language":"Swift","readme":"# TKDotSegment\n\u003e A segment with dot animation\n\n[![Swift Version][swift-image]][swift-url]\n[![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/TBXark/TKDotSegment/master/LICENSE)\n[![CocoaPods](http://img.shields.io/cocoapods/v/TKDotSegment.svg?style=flat)](http://cocoapods.org/?q=TKDotSegment)\n[![CocoaPods](http://img.shields.io/cocoapods/p/TKDotSegment.svg?style=flat)](http://cocoapods.org/?q=TKDotSegment)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Support](https://img.shields.io/badge/support-iOS%208%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/)\n\n\n![](demo.gif)\n\n## Requirements\n\n- iOS 8.0+\n- Xcode 9.0\n- Swift 4.0\n\n## Installation\n\n#### CocoaPods\nYou can use [CocoaPods](http://cocoapods.org/) to install `TKDotSegment` by adding it to your `Podfile`:\n\n```ruby\nplatform :ios, '8.0'\nuse_frameworks!\npod 'TKDotSegment'\n```\n\nTo get the full benefits import `TKDotSegment` wherever you import UIKit\n\n``` swift\nimport UIKit\nimport TKDotSegment\n```\n#### Carthage\nCreate a `Cartfile` that lists the framework and run `carthage update`. Follow the [instructions](https://github.com/Carthage/Carthage#if-youre-building-for-ios) to add `$(SRCROOT)/Carthage/Build/iOS/TKDotSegment.framework` to an iOS project.\n\n```\ngithub \"tbxark/TKDotSegment\"\n```\n#### Manually\n1. Download and drop ```TKDotSegmentControl.swift``` in your project.  \n2. Congratulations!  \n\n## Usage example\n\n```\n\nlet titles = [\"First\", \"Second\", \"Third\", \"Fourth\"]\nlet  segment = TKDotSegmentControl(titles: titles, frame: CGRect(x: 0, y: 0, width: 300, height: 40))\nsegment.dotColor = UIColor(red:1,  green:0.539,  blue:0.490, alpha:1)\nsegment.selectTitleColor = UIColor(red:1,  green:0.539,  blue:0.490, alpha:1)\nsegment.numOfDot = 4\nsegment.dotSpace = 6\nsegment.clickAction = { (index: Int, changeOffset: Bool) in\n    print(\"Segment Select Index: \\(index)\")\n}\n\n```\n\n### Base\n\n|变量名|描述|Description|\n|---|---|---|\n|titles|选项标题|segment title|\n|numOfDot|圆点数目| dot count|\n|dotDiameter|圆点直径|dot diameter|\n|dotSpace|圆点间距(负数则自动计算)|dot space(automatic calculation when value is a positive number)|\n|dotColor|圆点颜色|dot color|\n|selectTitleColor|标题被选中时的颜色|The color of the title is selected|\n|unSelectTitleColor|标题未被选中时的颜色|The color of the title is not selected|\n|titleFont|标题字体|The  font of the title |\n|PLDot|圆点(可重写drawRect来自定义形状)|Override drawRect to customize shape|\n\n\n---\n1 . 改变 Index (change index)\n\n```\n    func changeSelectedIndex(index: Int, animate: Bool = true)\n```\n\n2 . 接受 Index 变化事件 (index value change event)\n\n```\nTKDotSegmentAction = (index: Int,  internaliFlag: Bool) -\u003e Void\n\n```\n\n`index` 被选择的 index (selected index)\n\n`internaliFlag` 是否内部点击触发的标志位 (event by click flag)\n\n3 . 自定义圆点形状(Custom dot shape)\n\n重写`PLDot` 的 `drawRect` 方法就可以了\n\nOverwrite the ` drawRect`  of ` PLDot `\n\n\n\n## Release History\n\n* 1.4.0\n  Support swift 4.0\n\n* 1.3.1\n  Support swift 3.0\n\n* 1.0.2\n  Complete basic functions, add Cocoapod and Carthage support\n\n## Contribute\n\nWe would love for you to contribute to **TKDotSegment**, check the ``LICENSE`` file for more info.\n\n## Meta\n\nTBXark – [@tbxark](https://twitter.com/tbxark) – tbxark@outlook.com\n\nDistributed under the MIT license. See ``LICENSE`` for more information.\n\n[https://github.com/TBXark](https://github.com/TBXark)\n\n[swift-image]:https://img.shields.io/badge/swift-3.0-orange.svg\n[swift-url]: https://swift.org/\n[license-image]: https://img.shields.io/badge/License-MIT-blue.svg\n[license-url]: LICENSE\n[travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square\n[travis-url]: https://travis-ci.org/dbader/node-datadog-metrics\n[codebeat-image]: https://codebeat.co/badges/c19b47ea-2f9d-45df-8458-b2d952fe9dad\n[codebeat-url]: https://codebeat.co/projects/github-com-vsouza-awesomeios-com\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftbxark%2Ftkdotsegment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftbxark%2Ftkdotsegment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftbxark%2Ftkdotsegment/lists"}