{"id":20727281,"url":"https://github.com/soapyigu/yghorizontalscroller","last_synced_at":"2025-04-23T18:53:06.626Z","repository":{"id":56929083,"uuid":"58427084","full_name":"soapyigu/YGHorizontalScroller","owner":"soapyigu","description":"A simple horizontal scroller framework implemented by Swift","archived":false,"fork":false,"pushed_at":"2016-05-16T15:53:23.000Z","size":12871,"stargazers_count":36,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T12:35:57.641Z","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/soapyigu.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-05-10T03:29:46.000Z","updated_at":"2024-06-22T10:29:44.000Z","dependencies_parsed_at":"2022-08-21T06:20:35.259Z","dependency_job_id":null,"html_url":"https://github.com/soapyigu/YGHorizontalScroller","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soapyigu%2FYGHorizontalScroller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soapyigu%2FYGHorizontalScroller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soapyigu%2FYGHorizontalScroller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soapyigu%2FYGHorizontalScroller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soapyigu","download_url":"https://codeload.github.com/soapyigu/YGHorizontalScroller/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250496534,"owners_count":21440227,"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-11-17T04:29:52.122Z","updated_at":"2025-04-23T18:53:06.608Z","avatar_url":"https://github.com/soapyigu.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YGHorizontalScroller\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[![CocoaPods](https://img.shields.io/badge/pod-v0.0.4-blue.svg)]()\n\nYGHorizontalScroller is a simple horizontal scroller implemented by Swift, this scroller will automatically center and highlight the subview you select or click.\n\n## Requirements\n\n* iOS 8.0+\n* Xcode 6.0+\n\n##Instalation\n\n###CocoaPods\n\n[CocoaPods](https://cocoapods.org/) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\nTo integrate AutoLayoutPlus into your Xcode project using CocoaPods, include this in your Podfile:\n\n```ruby\nplatform :ios, '8.0'\nuse_frameworks!\n\npod 'YGHorizontalScroller'\n```\n\nOr just copy YGHorizontalScroller.swift into your project\n\n## Usage\n\nYGHorizontalScroller works by wrapping sroller and UIViews together and offers a flexiable protocal with methods. To make use of methods don't forget to import YGHorizontalScroller into your code:\n\n```swift\nimport YGHorizontalScroller\n```\n**Note: If you encounter an import error, building your project may resolve the problem**\n\nYou can create the scroll view by:\n```swift\nscroller = YGHorizontalScroller(frame: CGRect(x: 0, y: 100, width: screenWidth, height: 300))\nview.addSubview(scroller)\n\nscroller.viewWidth = 200\nscroller.viewHeight = 300\nscroller.viewPadding = 10\nscroller.viewOffset = 100\n  \nscroller.delegate = self\nscroller.reload()\n```\n\nThen implement `YGHorizontalScrollerDelegate` protocol:\n```swift\nfunc numberOfViews(scroller: YGHorizontalScroller) -\u003e Int {\n  return images.count\n}\n  \nfunc cellForViewAtIndex(scroller: YGHorizontalScroller, index: Int) -\u003e UIView {\n  let image = images[index]\n  let imageView = UIImageView(image: image)\n      \n  if currentIndex == index {\n    imageView.backgroundColor = UIColor.whiteColor()\n  } else {\n    imageView.backgroundColor = UIColor.blackColor()\n  }\n    \n  return imageView\n}\n  \nfunc didSelectViewAtIndex(scroller: YGHorizontalScroller, index: Int) {\n  let previousView = scroller.viewAtIndex(currentIndex)\n  previousView.backgroundColor = UIColor.blackColor()\n    \n  currentIndex = index\n    \n  let currentView = scroller.viewAtIndex(currentIndex)\n  currentView.backgroundColor = UIColor.whiteColor\n}\n  \nfunc initialViewIndex(scroller: YGHorizontalScroller) -\u003e Int {\n  return 0\n}\n```\n\n# Screenshots\n![portrait](https://github.com/soapyigu/YGHorizontalScroller/blob/master/Screenshots/portrait.gif)\n![landscape](https://github.com/soapyigu/YGHorizontalScroller/blob/master/Screenshots/landscape.gif)\n\n## Credits\n\nOwned and maintained by Yi. \n\n## Contributing\n\nBug reports and pull requests are welcome.\n\n## License\n\nYGHorizontalScroller is released under the MIT license. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoapyigu%2Fyghorizontalscroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoapyigu%2Fyghorizontalscroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoapyigu%2Fyghorizontalscroller/lists"}