Skip to content

Commit

Permalink
var -> let, where we can
Browse files Browse the repository at this point in the history
  • Loading branch information
kobim committed Jul 7, 2015
1 parent e69afe5 commit e045739
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions SLPagingViewSwift/SLPagingViewSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
let originX = (self.SCREENSIZE.width/2.0 - vSize.width/2.0) + CGFloat(i * 100)
v.frame = CGRectMake(originX, 8, vSize.width, vSize.height)
v.tag = i
var tap = UITapGestureRecognizer(target: self, action: "tapOnHeader:")
let tap = UITapGestureRecognizer(target: self, action: "tapOnHeader:")
v.addGestureRecognizer(tap)
v.userInteractionEnabled = true
self.navigationBarView.addSubview(v)
Expand Down Expand Up @@ -162,11 +162,6 @@ public class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
self.setCurrentIndex(self.indexSelected, animated: false)
}

public override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

public override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
self.navigationBarView.frame = CGRectMake(0, 0, self.SCREENSIZE.width, 44)
Expand Down Expand Up @@ -197,7 +192,7 @@ public class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
}
self.indexSelected = index
// Get the right position and update it
var xOffset = CGFloat(index) * self.SCREENSIZE.width
let xOffset = CGFloat(index) * self.SCREENSIZE.width
self.scrollView.setContentOffset(CGPointMake(xOffset, self.scrollView.contentOffset.y), animated: animated)
}

Expand Down Expand Up @@ -254,7 +249,7 @@ public class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
}

private func sendNewIndex(scrollView: UIScrollView){
var xOffset = Float(scrollView.contentOffset.x)
let xOffset = Float(scrollView.contentOffset.x)
var currentIndex = (Int(roundf(xOffset)) % (self.navigationBarView.subviews.count * Int(self.SCREENSIZE.width))) / Int(self.SCREENSIZE.width)
if self.needToShowPageControl && self.pageControl.currentPage != currentIndex {
self.pageControl.currentPage = currentIndex
Expand Down

0 comments on commit e045739

Please sign in to comment.