Swiftpack.co - shayan77/SHSegmentedControl as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by shayan77.
shayan77/SHSegmentedControl 1.0.5
When you want a fully UISegmentedControl or UISwitch you can use SHSegmentedControl which is written in Swift.
⭐️ 19
🕓 4 years ago
iOS
.package(url: "https://github.com/shayan77/SHSegmentedControl.git", from: "1.0.5")

SHSegmentedControl

License Platform

When you want a fully UISegmentedControl or UISwitch you can use SHSegmentedControl which is written in Swift.

Demo

Features

  1. Uou can customize as much as you can
  2. Colors, fonts, radius and all things can be set
  3. Use text or icons as segments, or add your own custom segments
  4. Right-to-left languages support

Requirements

  • iOS 11.0+
  • Xcode 9+

Swift Package Manager

SHSegmentedControl is available through Swift Package Manager. To install it, simply go to Xcode under File > Swift Packages > Add Package Dependency...

Manually

If you prefer not to use SPM or CocoaPods, you can integrate SHSegmentedControl into your project manually.

Usage

let control = SHSegmentedControl(
    frame: CGRect(x: 0, y: 0, width: 350, height: 50),
    segments: LabelSegment.segments(withTitles: ["Segment1", "Segment2", "Segment3"],
    normalFont: UIFont(name: "HelveticaNeue-Light", size: 14.0)!,
    normalTextColor: .red,
    selectedFont: UIFont(name: "HelveticaNeue-Bold", size: 14.0)!,
    selectedTextColor: .green),
    index: 1,
    options: [.backgroundColor(.white),
              .indicatorViewBackgroundColor(.blue)])
control.addTarget(self, action: #selector(ViewController.controlValueChanged(_:)), for: .valueChanged)
view.addSubview(control)

Contribution

Feel free to submit Pull Requests or send me your feedback and suggestions!

Author

Shayan Mehranpoor

License

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

GitHub

link
Stars: 19
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics