diff --git a/Demos/TinderLike/.DS_Store b/Demos/TinderLike/.DS_Store
index 9ee1c77..6de86e1 100644
Binary files a/Demos/TinderLike/.DS_Store and b/Demos/TinderLike/.DS_Store differ
diff --git a/Demos/TinderLike/TinderLike.xcodeproj/project.xcworkspace/xcshareddata/TinderLike.xccheckout b/Demos/TinderLike/TinderLike.xcodeproj/project.xcworkspace/xcshareddata/TinderLike.xccheckout
new file mode 100644
index 0000000..38434ca
--- /dev/null
+++ b/Demos/TinderLike/TinderLike.xcodeproj/project.xcworkspace/xcshareddata/TinderLike.xccheckout
@@ -0,0 +1,41 @@
+
+
+
+
+ IDESourceControlProjectFavoriteDictionaryKey
+
+ IDESourceControlProjectIdentifier
+ A1F39B9D-B8F2-4991-A41D-7EC7D7B4A7D6
+ IDESourceControlProjectName
+ TinderLike
+ IDESourceControlProjectOriginsDictionary
+
+ 37BEB7E0617C793883B527F4F18507B85BD66E2E
+ github.com:StefanLage/SLPagingViewSwift.git
+
+ IDESourceControlProjectPath
+ Demos/TinderLike/TinderLike.xcodeproj
+ IDESourceControlProjectRelativeInstallPathDictionary
+
+ 37BEB7E0617C793883B527F4F18507B85BD66E2E
+ ../../../..
+
+ IDESourceControlProjectURL
+ github.com:StefanLage/SLPagingViewSwift.git
+ IDESourceControlProjectVersion
+ 111
+ IDESourceControlProjectWCCIdentifier
+ 37BEB7E0617C793883B527F4F18507B85BD66E2E
+ IDESourceControlProjectWCConfigurations
+
+
+ IDESourceControlRepositoryExtensionIdentifierKey
+ public.vcs.git
+ IDESourceControlWCCIdentifierKey
+ 37BEB7E0617C793883B527F4F18507B85BD66E2E
+ IDESourceControlWCCName
+ SLPagingViewSwift
+
+
+
+
diff --git a/Demos/TinderLike/TinderLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/UserInterfaceState.xcuserstate b/Demos/TinderLike/TinderLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..7914393
Binary files /dev/null and b/Demos/TinderLike/TinderLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/Demos/TinderLike/TinderLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/WorkspaceSettings.xcsettings b/Demos/TinderLike/TinderLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000..bfffcfe
--- /dev/null
+++ b/Demos/TinderLike/TinderLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/WorkspaceSettings.xcsettings
@@ -0,0 +1,10 @@
+
+
+
+
+ HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
+
+ SnapshotAutomaticallyBeforeSignificantChanges
+
+
+
diff --git a/Demos/TinderLike/TinderLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/TinderLike.xcscheme b/Demos/TinderLike/TinderLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/TinderLike.xcscheme
new file mode 100644
index 0000000..819bb99
--- /dev/null
+++ b/Demos/TinderLike/TinderLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/TinderLike.xcscheme
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Demos/TinderLike/TinderLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/xcschememanagement.plist b/Demos/TinderLike/TinderLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..d792c89
--- /dev/null
+++ b/Demos/TinderLike/TinderLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,27 @@
+
+
+
+
+ SchemeUserState
+
+ TinderLike.xcscheme
+
+ orderHint
+ 0
+
+
+ SuppressBuildableAutocreation
+
+ F85CA9A41A61963B0013CF3F
+
+ primary
+
+
+ F85CA9B91A61963B0013CF3F
+
+ primary
+
+
+
+
+
diff --git a/Demos/TinderLike/TinderLike/AppDelegate.swift b/Demos/TinderLike/TinderLike/AppDelegate.swift
index 714797c..93fdcd0 100644
--- a/Demos/TinderLike/TinderLike/AppDelegate.swift
+++ b/Demos/TinderLike/TinderLike/AppDelegate.swift
@@ -44,7 +44,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
controller?.pagingViewMoving = ({ subviews in
for v in subviews {
- var lbl = v as UIImageView
+ var lbl = v as! UIImageView
var c = gray
if(lbl.frame.origin.x > 45 && lbl.frame.origin.x < 145) {
diff --git a/Demos/TwitterLike/.DS_Store b/Demos/TwitterLike/.DS_Store
index 1f3033c..f58620c 100644
Binary files a/Demos/TwitterLike/.DS_Store and b/Demos/TwitterLike/.DS_Store differ
diff --git a/Demos/TwitterLike/TwitterLike.xcodeproj/project.xcworkspace/xcshareddata/TwitterLike.xccheckout b/Demos/TwitterLike/TwitterLike.xcodeproj/project.xcworkspace/xcshareddata/TwitterLike.xccheckout
new file mode 100644
index 0000000..eadcd90
--- /dev/null
+++ b/Demos/TwitterLike/TwitterLike.xcodeproj/project.xcworkspace/xcshareddata/TwitterLike.xccheckout
@@ -0,0 +1,41 @@
+
+
+
+
+ IDESourceControlProjectFavoriteDictionaryKey
+
+ IDESourceControlProjectIdentifier
+ A2F0E46F-87FD-4AF8-8C13-151E046F1B4E
+ IDESourceControlProjectName
+ TwitterLike
+ IDESourceControlProjectOriginsDictionary
+
+ 37BEB7E0617C793883B527F4F18507B85BD66E2E
+ github.com:loganisitt/SLPagingViewSwift.git
+
+ IDESourceControlProjectPath
+ Demos/TwitterLike/TwitterLike.xcodeproj
+ IDESourceControlProjectRelativeInstallPathDictionary
+
+ 37BEB7E0617C793883B527F4F18507B85BD66E2E
+ ../../../..
+
+ IDESourceControlProjectURL
+ github.com:loganisitt/SLPagingViewSwift.git
+ IDESourceControlProjectVersion
+ 111
+ IDESourceControlProjectWCCIdentifier
+ 37BEB7E0617C793883B527F4F18507B85BD66E2E
+ IDESourceControlProjectWCConfigurations
+
+
+ IDESourceControlRepositoryExtensionIdentifierKey
+ public.vcs.git
+ IDESourceControlWCCIdentifierKey
+ 37BEB7E0617C793883B527F4F18507B85BD66E2E
+ IDESourceControlWCCName
+ SLPagingViewSwift
+
+
+
+
diff --git a/Demos/TwitterLike/TwitterLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/UserInterfaceState.xcuserstate b/Demos/TwitterLike/TwitterLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..b261338
Binary files /dev/null and b/Demos/TwitterLike/TwitterLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/Demos/TwitterLike/TwitterLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/WorkspaceSettings.xcsettings b/Demos/TwitterLike/TwitterLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000..bfffcfe
--- /dev/null
+++ b/Demos/TwitterLike/TwitterLike.xcodeproj/project.xcworkspace/xcuserdata/Logan.xcuserdatad/WorkspaceSettings.xcsettings
@@ -0,0 +1,10 @@
+
+
+
+
+ HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
+
+ SnapshotAutomaticallyBeforeSignificantChanges
+
+
+
diff --git a/Demos/TwitterLike/TwitterLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/TwitterLike.xcscheme b/Demos/TwitterLike/TwitterLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/TwitterLike.xcscheme
new file mode 100644
index 0000000..511bbda
--- /dev/null
+++ b/Demos/TwitterLike/TwitterLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/TwitterLike.xcscheme
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Demos/TwitterLike/TwitterLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/xcschememanagement.plist b/Demos/TwitterLike/TwitterLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..6bcab09
--- /dev/null
+++ b/Demos/TwitterLike/TwitterLike.xcodeproj/xcuserdata/Logan.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,27 @@
+
+
+
+
+ SchemeUserState
+
+ TwitterLike.xcscheme
+
+ orderHint
+ 0
+
+
+ SuppressBuildableAutocreation
+
+ F85CA9701A618E180013CF3F
+
+ primary
+
+
+ F85CA9851A618E180013CF3F
+
+ primary
+
+
+
+
+
diff --git a/Demos/TwitterLike/TwitterLike/AppDelegate.swift b/Demos/TwitterLike/TwitterLike/AppDelegate.swift
index f38c29b..5d5c85c 100644
--- a/Demos/TwitterLike/TwitterLike/AppDelegate.swift
+++ b/Demos/TwitterLike/TwitterLike/AppDelegate.swift
@@ -46,7 +46,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UITableViewDelegate, UITa
var i = 0
var xOffset = scrollView.contentOffset.x
for v in subviews {
- var lbl = v as UILabel
+ var lbl = v as! UILabel
var alpha = CGFloat(0)
if(lbl.frame.origin.x > 45 && lbl.frame.origin.x < 145) {
@@ -129,8 +129,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UITableViewDelegate, UITa
cell = UITableViewCell(style: .Default, reuseIdentifier: cellIdentifier)
cell?.textLabel?.numberOfLines = 0
}
- cell!.imageView?.image = UIImage(named: NSString(format: "avatar_%d.jpg", indexPath.row % 3))
- cell!.textLabel!.text = self.dataSource?.objectAtIndex(indexPath.row) as String
+ cell!.imageView?.image = UIImage(named: NSString(format: "avatar_%d.jpg", indexPath.row % 3) as String)
+ cell!.textLabel!.text = self.dataSource?.objectAtIndex(indexPath.row) as? String
return cell!
}
diff --git a/SLPagingViewSwift/SLPagingViewSwift.swift b/SLPagingViewSwift/SLPagingViewSwift.swift
index ff35af4..abc80ab 100644
--- a/SLPagingViewSwift/SLPagingViewSwift.swift
+++ b/SLPagingViewSwift/SLPagingViewSwift.swift
@@ -73,16 +73,18 @@ class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
*
* @return Instance of SLPagingViewController
*/
- init(items: NSArray, views: NSArray, showPageControl: Bool, navBarBackground: UIColor){
- super.init()
+ init(items: NSArray, views: NSArray, showPageControl: Bool, navBarBackground: UIColor) {
+
+ super.init(nibName: nil, bundle: nil)
+
needToShowPageControl = showPageControl
navigationBarView.backgroundColor = navBarBackground
isUserInteraction = true
var i: Int = 0
for item in items{
if item.isKindOfClass(UIView.classForCoder()){
- var v = item as UIView
- var vSize: CGSize = v.isKindOfClass(UILabel.classForCoder()) ? self.getLabelSize(v as UILabel) : v.frame.size
+ var v = item as! UIView
+ var vSize: CGSize = v.isKindOfClass(UILabel.classForCoder()) ? self.getLabelSize(v as! UILabel) : v.frame.size
var 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
@@ -100,12 +102,12 @@ class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
i = 0
for controller in views{
if controller.isKindOfClass(UIView.classForCoder()){
- var ctr = controller as UIView
+ var ctr = controller as! UIView
ctr.tag = i
controllerKeys.addObject(NSNumber(integer: i))
}
else if controller.isKindOfClass(UIViewController.classForCoder()){
- var ctr = controller as UIViewController
+ var ctr = controller as! UIViewController
ctr.view.tag = i
controllerKeys.addObject(NSNumber(integer: i))
}
@@ -113,7 +115,7 @@ class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
}
if controllerKeys.count == views.count {
- self.viewControllers = NSDictionary(objects: views, forKeys: controllerKeys)
+ self.viewControllers = NSDictionary(objects: views as [AnyObject], forKeys: controllerKeys as [AnyObject])
}
else{
var exc = NSException(name: "View Controllers error", reason: "Some objects in viewControllers are not kind of UIViewController!", userInfo: nil)
@@ -234,7 +236,7 @@ class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
// MARK: - Internal methods
private func setupPagingProcess() {
var frame: CGRect = CGRectMake(0, 0, SCREENSIZE.width, self.view.frame.height)
-
+
self.scrollView = UIScrollView(frame: frame)
self.scrollView.backgroundColor = UIColor.clearColor()
self.scrollView.pagingEnabled = true
@@ -276,7 +278,7 @@ class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
var i: Int = 0
self.viewControllers.enumerateKeysAndObjectsUsingBlock({ key, obj, stop in
var rect: CGRect = CGRectMake(self.SCREENSIZE.width * CGFloat(i), 0, self.SCREENSIZE.width, self.SCREENSIZE.height)
- var v = obj as UIView
+ var v = obj as! UIView
v.frame = rect
self.scrollView.addSubview(v)
i++
@@ -311,7 +313,7 @@ class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
func tapOnHeader(recognizer: UITapGestureRecognizer){
if(self.isUserInteraction){
var key = recognizer.view?.tag
- var view = self.viewControllers.objectForKey(NSNumber(integer: key!)) as UIView
+ var view = self.viewControllers.objectForKey(NSNumber(integer: key!)) as! UIView
self.scrollView.scrollRectToVisible(view.frame, animated: true)
}
}
@@ -322,7 +324,7 @@ class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
var xOffset = scrollView.contentOffset.x
var i = 0
for obj in self.navItems {
- var v:UIView = obj as UIView
+ var v:UIView = obj as! UIView
var distance = 100 + self.navigationSideItemsStyle.rawValue
var vSize = v.frame.size
var originX = self.getOriginX(vSize, idx: CGFloat(i), distance: CGFloat(distance), xOffset: CGFloat(xOffset))