{"id":19773925,"url":"https://github.com/badoo/bmasliders","last_synced_at":"2025-04-30T18:32:29.870Z","repository":{"id":28377855,"uuid":"31891926","full_name":"badoo/BMASliders","owner":"badoo","description":"Configurable simple and range sliders","archived":false,"fork":false,"pushed_at":"2017-04-19T18:01:44.000Z","size":1124,"stargazers_count":92,"open_issues_count":7,"forks_count":27,"subscribers_count":39,"default_branch":"master","last_synced_at":"2024-10-31T16:29:12.489Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","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/badoo.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-03-09T10:24:39.000Z","updated_at":"2024-08-25T21:25:45.000Z","dependencies_parsed_at":"2022-08-20T18:50:54.705Z","dependency_job_id":null,"html_url":"https://github.com/badoo/BMASliders","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/badoo%2FBMASliders","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badoo%2FBMASliders/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badoo%2FBMASliders/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badoo%2FBMASliders/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/badoo","download_url":"https://codeload.github.com/badoo/BMASliders/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224219555,"owners_count":17275477,"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-12T05:11:32.371Z","updated_at":"2024-11-12T05:11:33.037Z","avatar_url":"https://github.com/badoo.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BMASliders [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Build Status](https://api.travis-ci.org/badoo/BMASliders.svg?branch=1.0.0)](https://travis-ci.org/badoo/BMASliders)\n`BMASliders` is a set of reusable sliders. It includes two kind of sliders, one with customizable ranges -`BMARangeSlider`- and a simpler one -`BMASlider`- along with its labeled counterparts -`BMALabeledRangeSlider` and `BMALabeledSlider`\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"./demoimages/labeled-range-slider-movie.gif\" /\u003e\n\u003c/div\u003e\n\n## Features\n- Live rendering in Interface Builder\n- Configurable minimum distance between handlers\n- Ability to allow only discretized values\n- Overflow signal\n- Configurable appearance\n\n## How to use\n### BMALabeledRangeSlider\n`BMALabeledRangeSlider` provides a range slider with a title and a detail of the selected range. You can configure many of its properties by using *Attributes inspector* in *Interface Builder*. Alternatively, you can initialize in code as follows:\n\n```objectivec\nself.labeledRangeSlider.minimumValue = 0.;\nself.labeledRangeSlider.maximumValue = 130.;\nself.labeledRangeSlider.currentLowerValue = 30.;\nself.labeledRangeSlider.currentUpperValue = 70.;\nself.labeledRangeSlider.step = 1.;\nself.labeledRangeSlider.minimumDistance = 4.;  // between handlers\nself.labeledRangeSlider.style = [[BMASliderLiveRenderingStyle alloc] init];\nself.labeledRangeSlider.title = [[NSAttributedString alloc] initWithString:@\"My title\"];\nself.labeledRangeSlider.rangeFormatter = self.myRangeFormatter;\n[self.labeledRangeSlider addTarget:self action:@selector(valueChanged) forControlEvents:UIControlEventValueChanged];\n```\n\nEverything should be self-explanatory but `rangeFormatter` and `style`. For `rangeFormatter` you must provide an object conforming to the `BMARangeFormatter` protocol:\n```objectivec\n@protocol BMARangeFormatter \u003cNSObject\u003e\n@property (nonatomic) BOOL hasLowerValue;\n@property (nonatomic) CGFloat lowerValue;\n@property (nonatomic) CGFloat upperValue;\n@property (nonatomic, getter=isOverflow) BOOL overflow;\n\n- (NSAttributedString *)formattedString;\n@end\n```\n\nWhen the selected range changes, `BMALabeledRangeSlider` will set properties `hasLowerValue`, `lowerValue`, `upperValue` and `overflow` to the `rangeFormatter` instance and will ask it for the string representation of the range by calling `formattedString`.\n\nFor the `style` property, you must supply an instance that returns the images for the handlers and the line backgrounds. `BMASliderLiveRenderingStyle` will be used by default in case you don't provide your own style.\n```objectivec\n@protocol BMASliderStyling \u003cNSObject\u003e\n- (UIImage *)unselectedLineImage;\n- (UIImage *)selectedLineImage;\n- (UIImage *)handlerImage;\n@end\n```\n\nFor convenience, `BMASliders` support the UIAppearance protocol so you can easily style all the sliders in your app:\n```objectivec\n[BMARangeSlider appearance].style = [[BMASliderDefaultStyle alloc] init];\n[BMASlider appearance].style = [[BMASliderDefaultStyle alloc] init];\n```\n\n### BMALabeledSlider\n`BMALabeledRangeSlider` provides a range slider with a title and a detail of the selected range. It works pretty much the same as `BMALabeledRangeSlider`, but it's got just a `currentValue`.\n\n```objectivec\nself.labeledSlider.minimumValue = 0.;\nself.labeledSlider.maximumValue = 130.;\nself.labeledSlider.currentValue = 60.;\nself.labeledSlider.style = [[BMASliderDefaultStyle alloc] init];\nself.labeledSlider.title = [[NSAttributedString alloc] initWithString:@\"My title\"];\nself.labeledSlider.rangeFormatter = self.myRangeFormatter;\n[self.labeledSlider addTarget:self action:@selector(valueChanged) forControlEvents:UIControlEventValueChanged];\n```\n\nNote that `rangeFormatter` must again conform to `BMARangeFormatter` protocol. In this case however, the slider will set `hasLowerValue` to `false` and `currentValue` will be assigned to the `upperValue` property.\n\n### BMARangeSlider and BMASlider\nThese are the non-labeled counterparts of `BMALabeledRangeSlider` and `BMALabeledSlider`. They don't have any `title` or `rangeFormatter` so they are easier to configure and can be used to render your custom layouts.\n\n## Live rendering\n`BMASliders` takes advantage of `IBInspectable` and `IBDesignable` directives that allow you to see how the component renders in *Interface Builder* and change the slider's attributes by using the *Attributes inspector*.\n\u003cimg src=\"./demoimages/live-rendering.png\" /\u003e\n\n## How to install\n### Using CocoaPods\n\n1. Make sure `use_frameworks!` is added to your `Podfile`. Live rendering with XIB-based views requires `use_frameworks!` to work, which is available from CocoaPods 0.36. If you don't add `use_frameworks!` in your `Podfile` live rendering won't work and you'll get some nasty complains in Interface Builder. However, everything should work fine at run time.\n\n2. Include the following line in your `Podfile`:\n    ```\n    pod 'BMASliders', '~\u003e 1.0.0' \n    ```\nIf you like to live on the bleeding edge, you can use the `master` branch with:\n    ```\n    pod 'BMASliders', :git =\u003e 'https://github.com/badoo/BMASliders'\n    ```\n3. Run `pod install`\n\n### Manually\n\n1. Clone, add as a submodule or [download.](https://github.com/badoo/BMASliders/archive/master.zip)\n2. Add all the files under `Component` to your project.\n3. Make sure your project is configured to use ARC.\n\n## License\nSource code is distributed under MIT license.\n\n## Blog\nRead more on our [tech blog](http://techblog.badoo.com/) or explore our other [open source projects](https://github.com/badoo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadoo%2Fbmasliders","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadoo%2Fbmasliders","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadoo%2Fbmasliders/lists"}