Code Monkey home page Code Monkey logo

badgesegments's Introduction

BadgeSegments

CI Status Version License Platform

ScreenShots

standard

alt text

Underlined

alt text

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • Swift => 5
  • iOS => 10

Installation

Cocoapods

BadgeSegments is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'BadgeSegments'

Manual

simply copy classes folder to your project directory

How to Use

add a UIView to your view Controller and sub class it from BadgeSegments class

@IBOutlet weak var badgeSegment: BadgeSegments!
  override func viewDidLoad() {
      super.viewDidLoad()


        let items = [SegmentItem(title: "first",isSelected: false,badgeNumber: 20),
                   SegmentItem(title: "second",isSelected: true),
                   SegmentItem(title: "third",isSelected: false,badgeNumber: 12)]
      badgeSegment.appearence = .standard
      badgeSegment.delegate = self
      badgeSegment.setUpSegments(with: items)
  }

Delegate

class ViewController: UIViewController, BadgeSegmentDelegate {

   func didSelectSegment(with index: Int) {
      print(index)
   }
  

}

Change Values

 badgeSegment.setTitle(inIndex: 0, title: "changed")
      badgeSegment.setSelected(inIndex: 2)
      badgeSegment.setBadgeNumber(inIndex: 1, badgeNum: 12)

TO Do

  • add animation
  • more default appearences
  • support images
  • customize badge view
  • add UITest and UnitTest

Made with Love in ๐Ÿ‡ฎ๐Ÿ‡ท

Morteza Gharedaghi: [email protected]

feel free to create issue or open a pull request โ˜บ๏ธ

Used in

send your application name to me,if you used this library

  • Wink App

License

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

badgesegments's People

Contributors

mor4eza avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.