All Projects → sh-khashimov → RESegmentedControl

sh-khashimov / RESegmentedControl

Licence: MIT license
Customizable segmented control with style presets...

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to RESegmentedControl

Jxsegmentedview
A powerful and easy to use segmented view (segmentedcontrol, pagingview, pagerview, pagecontrol, categoryview) (腾讯新闻、今日头条、QQ音乐、网易云音乐、京东、爱奇艺、腾讯视频、淘宝、天猫、简书、微博等所有主流APP分类切换滚动视图)
Stars: ✭ 1,905 (+2406.58%)
Mutual labels:  switch, segmentedcontrol, segmented
ZSegmentedControl
Customizable segmented control, a UISwitch-like segmented control and Segmented pager written in Swift
Stars: ✭ 25 (-67.11%)
Mutual labels:  switch, segmentedcontrol
Bettersegmentedcontrol
An easy to use, customizable replacement for UISegmentedControl & UISwitch.
Stars: ✭ 1,782 (+2244.74%)
Mutual labels:  switch, segmentedcontrol
Iphone Tab In Android
android TabLayout widget at bottom like iPhone UITabBar
Stars: ✭ 181 (+138.16%)
Mutual labels:  tabbar
Youtube Ios
youtube iOS app template written in swift 5
Stars: ✭ 2,438 (+3107.89%)
Mutual labels:  tabbar
ControlBlockService2
This is the driver for the ControlBlock re.v 2.X, a power switch and input/output/gameapd gadget for the Raspberry Pi
Stars: ✭ 18 (-76.32%)
Mutual labels:  switch
Switch-Screenshots
Script to organize Nintendo Switch screenshots by directory instead of date.
Stars: ✭ 50 (-34.21%)
Mutual labels:  switch
Flutter bubble tab indicator
A Flutter library to add bubble tab indicator to TabBar
Stars: ✭ 149 (+96.05%)
Mutual labels:  tabbar
v-switch
Virtual Encrypted Switch across the network, using UDP + AES + TAP
Stars: ✭ 27 (-64.47%)
Mutual labels:  switch
ComicNX
NSFW comic browser for the Nintendo Switch
Stars: ✭ 15 (-80.26%)
Mutual labels:  switch
fake-08
A Pico-8 player/emulator for console homebrew
Stars: ✭ 374 (+392.11%)
Mutual labels:  switch
Expandedtabbar
ExpandedTabBar is a very creative designed solution for "more" items in UITabBarController. It's greate experience to have more comfortable and intuitive UI.
Stars: ✭ 219 (+188.16%)
Mutual labels:  tabbar
Amazon-Price-Alert
Price tracker of Amazon
Stars: ✭ 83 (+9.21%)
Mutual labels:  switch
Rdvtabbarcontroller
Highly customizable tabBar and tabBarController for iOS
Stars: ✭ 2,292 (+2915.79%)
Mutual labels:  tabbar
QWTabBar
自定义TabBar 使用简单
Stars: ✭ 19 (-75%)
Mutual labels:  tabbar
React Native Head Tab View
Add collapsible headers to your tab-view components.
Stars: ✭ 171 (+125%)
Mutual labels:  tabbar
when-switch
JavaScript functional implementation of switch/case
Stars: ✭ 20 (-73.68%)
Mutual labels:  switch
Sscustomtabbar
Simple Animated tabbar with native control
Stars: ✭ 251 (+230.26%)
Mutual labels:  tabbar
Vbrrollingpit
Simple, beautiful and interactive UITabBar
Stars: ✭ 252 (+231.58%)
Mutual labels:  tabbar
SliceControl
🍰 Simply a better & animated UISegmentedControl
Stars: ✭ 44 (-42.11%)
Mutual labels:  segmentedcontrol

RESegmentedControl

Swift Version CI Status Version Support Platform Documentation

RESegmentedControl is customizable segmented control with style presets.

Main Features
🎨 Supports style presets
🎫 Supports texts and images
🧮 Supports vertical and horizontal content layout
📥 Able to download and cache images
🎢 Natural and smooth animation between segments selection
🥌 Layout-Driven UI
🚀 Written in Swift

Preview

How to use

  • Import RESegmentedControl to your class:
import RESegmentedControl
  • Add UIView to Storyboard's ViewController. Change class and module to RESegmentedControl and @IBOutlet to your ViewController:

storyboard

/// Segmented Control
@IBOutlet weak var segmentedControl: RESegmentedControl!

or create a RESegmentedControl programmatically:

let segmentedControl = RESegmentedControl(frame: CGRect(x: 0, y: 0, width: 200, height: 44))
self.view.addSubview(segmentedControl)
// TODO: Add segmentedControl Auto-Layouts…
  • Configure your segmentedControl with items and preset:
// Specify a list of string that will be shown
let titles = ["safari", "chrome", "firefox"]

// Map a list of string to the [SegmentModel]
var segmentItems: [SegmentModel] {
	return titles.map({ SegmentModel(title: $0) })
}

// Create a preset to style the segmentedControl
let preset = BootstapPreset(backgroundColor: .white, selectedBackgroundColor: .black)

// segmentedControl configuration method
segmentedControl.configure(segmentItems: segmentItems, preset: preset)

To learn more, take a look at the demo project.

Layout Types

RESegmentedControl initialize with a list of SegmentModel. RESegmentedControl could be shown in three ways, with text only, image only or with text and image.

  • To show segments with text, initiate a SegmentModel with title variable:
let segmentsItem: [SegmentModel] = [SegmentModel(title: “Title”)]
  • To show image, initiate a SegmentModel with imageName variable:
let segmentsItem: [SegmentModel] = [SegmentModel(imageName: “imageNameInAseetCatalog”)]

initiate a SegmentModel with imageUrl variable to load image from remote server:

let imageUrl = “https://domain.com/image.png”
let segmentsItem: [SegmentModel] = [SegmentModel(imageUrl: imageUrl)]
  • To show text and image, initiate a SegmentModel with title and imageName or imageUrl variable:
let segmentsItem: [SegmentModel] = [SegmentModel(title: “Title”, imageName: “imageNameInAseetCatalog”)]

// Image remote location url
let imageUrl = “https://domain.com/image.png”
let segmentsItem: [SegmentModel] = [SegmentModel(title: “Title”, imageUrl: imageUrl)]

For more information, see BasicExampleViewController in the demo project.

API

  • Dynamically adds item:
func addItem(_ item: SegmentModel, atIndex index: Int? = nil)
  • Dynamically removes item:
func removeItem(atIndex index: Int? = nil)
  • Returns segment items count:
var segmentItemsCount: Int
  • Returns or dynamically changes selected index:
var selectedSegmentIndex: Int
  • Deselects selected segment item:
func deselect()
  • Replace segment item:
func replaceItem(_ item: SegmentModel, atIndex index: Int)

For more information, see ActionViewController in the demo project.

Presets and Styles

RESegmentedControl supports a wide range of customization appearance. It is also possible to apply ready-made presets of styles or create your own preset.

Currently 4 presets are available:

  • iOS7Preset - Stylizes to iOS7 system style.
struct iOS7Preset: SegmentedControlPresettable
  • iOS13Preset - Stylizes to iOS13 system style.
struct iOS13Preset: SegmentedControlPresettable
  • MaterialPreset - Stylizes to Material style.
struct MaterialPreset: SegmentedControlPresettable
  • BootstapPreset - Preset with minimal pre-stylization, designed to customize the preset to fit your needs.
struct BootstapPreset: SegmentedControlPresettable

For more information, see PresetsViewController in the demo project.

To learn more about how to create a preset, follow the Advanced Style Guide.

Installation

To learn more see a full API Reference, and check out the demo project included in the repository. When you are ready to install, follow the Installation Guide.

Requirements

App version Swift Xcode Platforms
current version Swift 5.0 Xcode 12 iOS 9.0

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Inspiration

Author

Sherzod Khashimov

Changelog

See changelog here

License

RESegmentedControl is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].