Skip to content

Commit

Permalink
Make indicator view public, remove addSubviewToIndicator method
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarm committed Jun 12, 2019
1 parent d77718d commit 0aa62db
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions Pod/Classes/BetterSegmentedControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

@IBDesignable open class BetterSegmentedControl: UIControl {
private class IndicatorView: UIView {
open class IndicatorView: UIView {
// MARK: Properties
fileprivate let segmentMaskView = UIView()
fileprivate var cornerRadius: CGFloat = 0 {
Expand All @@ -28,7 +28,7 @@ import Foundation
super.init(frame: CGRect.zero)
finishInit()
}
required init?(coder aDecoder: NSCoder) {
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
finishInit()
}
Expand Down Expand Up @@ -66,6 +66,10 @@ import Foundation
setNeedsLayout()
}
}

/// The currently selected index indicator view.
public let indicatorView = IndicatorView()

/// A list of options to configure the control with.
public var options: [BetterSegmentedControlOption]? {
get { return nil }
Expand Down Expand Up @@ -157,7 +161,6 @@ import Foundation
// MARK: Private properties
private let normalSegmentsView = UIView()
private let selectedSegmentsView = UIView()
private let indicatorView = IndicatorView()
private var initialIndicatorViewFrame: CGRect?

private var tapGestureRecognizer: UITapGestureRecognizer!
Expand Down Expand Up @@ -294,14 +297,6 @@ import Foundation
self.index = index
moveIndicatorViewToIndex(animated, shouldSendEvent: (self.index != oldIndex || alwaysAnnouncesValue))
}

// MARK: Indicator View Customization
/// Adds the passed view as a subview to the indicator view.
///
/// - Parameter view: The view to be added to the indicator view.
public func addSubviewToIndicator(_ view: UIView) {
indicatorView.addSubview(view)
}

// MARK: Animations
private func moveIndicatorViewToIndex(_ animated: Bool, shouldSendEvent: Bool) {
Expand Down

0 comments on commit 0aa62db

Please sign in to comment.