Skip to content

Commit

Permalink
remove throws modifier from protocols.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Barreto committed Jan 30, 2016
1 parent 4976a32 commit 7575cdd
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Example/Example/Youtube/YoutubeExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<You
}


override func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) throws {
try super.pagerTabStripViewController(pagerTabStripViewController, updateIndicatorFromIndex: fromIndex, toIndex: toIndex, withProgressPercentage: progressPercentage, indexWasChanged: indexWasChanged)
override func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) {
super.pagerTabStripViewController(pagerTabStripViewController, updateIndicatorFromIndex: fromIndex, toIndex: toIndex, withProgressPercentage: progressPercentage, indexWasChanged: indexWasChanged)
if indexWasChanged && toIndex > -1 && toIndex < viewControllers.count {
let child = viewControllers[toIndex] as! IndicatorInfoProvider
UIView.performWithoutAnimation({ [weak self] () -> Void in
Expand Down
4 changes: 2 additions & 2 deletions Sources/BarPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ public class BarPagerTabStripViewController: PagerTabStripViewController, PagerT

// MARK: - PagerTabStripDelegate

public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) throws {
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) {
barView.moveToIndex(index: toIndex, animated: true)
}

public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) throws {
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) {
barView.moveToIndex(fromIndex: fromIndex, toIndex: toIndex, progressPercentage: progressPercentage)
}
}
4 changes: 2 additions & 2 deletions Sources/BaseButtonBarPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UIColl
return calculateStretchedCellWidths(minimumCellWidths, suggestedStretchedCellWidth: newSuggestedStretchedCellWidth, previousNumberOfLargeCells: numberOfLargeCells)
}

public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) throws {
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) {
guard shouldUpdateButtonBarView else { return }
buttonBarView.moveToIndex(toIndex, animated: true, swipeDirection: toIndex < fromIndex ? .Right : .Left, pagerScroll: .Yes)

Expand All @@ -180,7 +180,7 @@ public class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UIColl
}
}

public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) throws {
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) {
guard shouldUpdateButtonBarView else { return }
buttonBarView.moveFromIndex(fromIndex, toIndex: toIndex, progressPercentage: progressPercentage, pagerScroll: .Yes)
if let changeCurrentIndexProgressive = changeCurrentIndexProgressive {
Expand Down
4 changes: 2 additions & 2 deletions Sources/ButtonBarPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public class ButtonBarPagerTabStripViewController: PagerTabStripViewController,
return calculateStretchedCellWidths(minimumCellWidths, suggestedStretchedCellWidth: newSuggestedStretchedCellWidth, previousNumberOfLargeCells: numberOfLargeCells)
}

public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) throws {
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) {
guard shouldUpdateButtonBarView else { return }
buttonBarView.moveToIndex(toIndex, animated: true, swipeDirection: toIndex < fromIndex ? .Right : .Left, pagerScroll: .Yes)

Expand All @@ -215,7 +215,7 @@ public class ButtonBarPagerTabStripViewController: PagerTabStripViewController,
}
}

public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) throws {
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) {
guard shouldUpdateButtonBarView else { return }
buttonBarView.moveFromIndex(fromIndex, toIndex: toIndex, progressPercentage: progressPercentage, pagerScroll: .Yes)
if let changeCurrentIndexProgressive = changeCurrentIndexProgressive {
Expand Down
8 changes: 4 additions & 4 deletions Sources/PagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public protocol IndicatorInfoProvider {

public protocol PagerTabStripDelegate: class {

func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) throws
func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int)
}

public protocol PagerTabStripIsProgressiveDelegate : PagerTabStripDelegate {

func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) throws
func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool)
}

public protocol PagerTabStripDataSource: class {
Expand Down Expand Up @@ -256,10 +256,10 @@ public class PagerTabStripViewController: UIViewController, UIScrollViewDelegate
if let progressiveDeledate = self as? PagerTabStripIsProgressiveDelegate where pagerBehaviour.isProgressiveIndicator {

let (fromIndex, toIndex, scrollPercentage) = progressiveIndicatorData(virtualPage)
try! progressiveDeledate.pagerTabStripViewController(self, updateIndicatorFromIndex: fromIndex, toIndex: toIndex, withProgressPercentage: scrollPercentage, indexWasChanged: changeCurrentIndex)
progressiveDeledate.pagerTabStripViewController(self, updateIndicatorFromIndex: fromIndex, toIndex: toIndex, withProgressPercentage: scrollPercentage, indexWasChanged: changeCurrentIndex)
}
else{
try! delegate?.pagerTabStripViewController(self, updateIndicatorFromIndex: min(oldCurrentIndex, pagerViewControllers.count - 1), toIndex: newCurrentIndex)
delegate?.pagerTabStripViewController(self, updateIndicatorFromIndex: min(oldCurrentIndex, pagerViewControllers.count - 1), toIndex: newCurrentIndex)
}
}

Expand Down
10 changes: 5 additions & 5 deletions Sources/SegmentedPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ public class SegmentedPagerTabStripViewController: PagerTabStripViewController,
}
segmentedControl.tintColor = settings.style.segmentedControlColor ?? segmentedControl.tintColor
segmentedControl.addTarget(self, action: "segmentedControlChanged:", forControlEvents: .ValueChanged)
try! reloadSegmentedControl()
reloadSegmentedControl()
}

public override func reloadPagerTabStripView() {
super.reloadPagerTabStripView()
if isViewLoaded() {
try! reloadSegmentedControl()
reloadSegmentedControl()
}
}

func reloadSegmentedControl() throws {
func reloadSegmentedControl() {
segmentedControl.removeAllSegments()
for (index, item) in viewControllers.enumerate(){
let child = item as! IndicatorInfoProvider
Expand All @@ -89,14 +89,14 @@ public class SegmentedPagerTabStripViewController: PagerTabStripViewController,

func segmentedControlChanged(sender: UISegmentedControl) {
let index = sender.selectedSegmentIndex
try! pagerTabStripViewController(self, updateIndicatorFromIndex: currentIndex, toIndex: index)
pagerTabStripViewController(self, updateIndicatorFromIndex: currentIndex, toIndex: index)
shouldUpdateSegmentedControl = false
moveToViewControllerAtIndex(index)
}

// MARK: - PagerTabStripDelegate

public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) throws {
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) {
if shouldUpdateSegmentedControl {
segmentedControl.selectedSegmentIndex = toIndex
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/TwitterPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ public class TwitterPagerTabStripViewController: PagerTabStripViewController, Pa

// MARK: - PagerTabStripDelegate

public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) throws {
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) {
fatalError()
}

public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) throws {
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) {

// move indicator scroll view
let distance = distanceValue
Expand Down

0 comments on commit 7575cdd

Please sign in to comment.