diff --git a/.travis.yml b/.travis.yml
index 8749c82..98ef051 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,12 +2,12 @@
# * http://www.objc.io/issue-6/travis-ci.html
# * https://github.com/supermarin/xcpretty#usage
-language: objective-c
+language: swift
# cache: cocoapods
# podfile: Example/Podfile
# before_install:
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example
script:
+
- set -o pipefail && xcodebuild test -workspace Example/SMSwipeableTabView.xcworkspace -scheme SMSwipeableTabView-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty
-- pod lib lint
diff --git a/Example/SMSwipeableTabView.xcodeproj/project.pbxproj b/Example/SMSwipeableTabView.xcodeproj/project.pbxproj
index cb54e07..9fa965f 100644
--- a/Example/SMSwipeableTabView.xcodeproj/project.pbxproj
+++ b/Example/SMSwipeableTabView.xcodeproj/project.pbxproj
@@ -496,6 +496,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = NO;
};
name = Debug;
};
@@ -508,6 +509,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = NO;
};
name = Release;
};
diff --git a/Example/SMSwipeableTabView.xcodeproj/xcshareddata/xcschemes/SMSwipeableTabView-Example.xcscheme b/Example/SMSwipeableTabView.xcodeproj/xcshareddata/xcschemes/SMSwipeableTabView-Example.xcscheme
index e1b4390..10d844a 100644
--- a/Example/SMSwipeableTabView.xcodeproj/xcshareddata/xcschemes/SMSwipeableTabView-Example.xcscheme
+++ b/Example/SMSwipeableTabView.xcodeproj/xcshareddata/xcschemes/SMSwipeableTabView-Example.xcscheme
@@ -37,10 +37,10 @@
+ shouldUseLaunchSchemeArgsEnv = "YES">
@@ -62,15 +62,18 @@
ReferencedContainer = "container:SMSwipeableTabView.xcodeproj">
+
+
@@ -86,10 +89,10 @@
diff --git a/Example/SMSwipeableTabView/AppDelegate.swift b/Example/SMSwipeableTabView/AppDelegate.swift
index 6f3d703..63f5882 100644
--- a/Example/SMSwipeableTabView/AppDelegate.swift
+++ b/Example/SMSwipeableTabView/AppDelegate.swift
@@ -1,4 +1,4 @@
-//
+ //
// AppDelegate.swift
// SMSwipeableTabView
//
diff --git a/Example/SMSwipeableTabView/ViewController.swift b/Example/SMSwipeableTabView/ViewController.swift
index b23c653..a6e198a 100644
--- a/Example/SMSwipeableTabView/ViewController.swift
+++ b/Example/SMSwipeableTabView/ViewController.swift
@@ -69,12 +69,35 @@ class ViewController: UIViewController, SMSwipeableTabViewControllerDelegate {
// Dispose of any resources that can be recreated.
}
- //MARK: SMSwipeableTabViewControllerDelegate CallBack
+ //MARK: SMSwipeableTabViewController Delegate CallBack
func didLoadViewControllerAtIndex(index: Int) -> UIViewController {
- let listVC = SMSimpleListViewController()
- listVC.dataSource = viewControllerDataSourceCollection[index]
- return listVC
+ switch index {
+ case 0:
+ let listVC = SMSimpleListViewController()
+ listVC.dataSource = viewControllerDataSourceCollection[index]
+ return listVC
+ case 1:
+ let vc = UIViewController()
+ vc.view.backgroundColor = UIColor.redColor()
+ return vc
+ case 2:
+ let listVC = SMSimpleListViewController()
+ listVC.dataSource = viewControllerDataSourceCollection[index]
+ return listVC
+ case 3:
+ let listVC = SMSimpleListViewController()
+ listVC.dataSource = viewControllerDataSourceCollection[index]
+ return listVC
+ case 5:
+ let vc = UIViewController()
+ vc.view.backgroundColor = UIColor.brownColor()
+ return vc
+ default:
+ let vc = UIViewController()
+ vc.view.backgroundColor = UIColor.greenColor()
+ return vc
+ }
}
}
diff --git a/Pod/Classes/SMSwipeableTabViewController.swift b/Pod/Classes/SMSwipeableTabViewController.swift
index 097348a..4f80f9a 100644
--- a/Pod/Classes/SMSwipeableTabViewController.swift
+++ b/Pod/Classes/SMSwipeableTabViewController.swift
@@ -41,6 +41,8 @@ public let SMButtonHighlightedImagesAttribute = "kButtonHighlightedImageAttribut
/// Take Bool as value. Set title label of tab bar button hidden.
public let SMButtonHideTitleAttribute = "kButtonShowTitleAttribute" // Set Bool instance
+/// Swipe constant
+public let kSelectionBarSwipeConstant: CGFloat = 3.0
public protocol SMSwipeableTabViewControllerDelegate {
func didLoadViewControllerAtIndex(index: Int) -> UIViewController
@@ -350,6 +352,6 @@ public class SMSwipeableTabViewController: UIViewController, UIPageViewControlle
public func scrollViewDidScroll(scrollView: UIScrollView) {
let xFromCenter:CGFloat = self.view.frame.size.width-scrollView.contentOffset.x
let xCoor = buttonsFrameArray[currentPageIndex].origin.x;
- selectionBar.frame = CGRectMake(xCoor-xFromCenter/CGFloat(titleBarDataSource?.count ?? 0), selectionBar.frame.origin.y, buttonsFrameArray[currentPageIndex].size.width, selectionBar.frame.size.height)
+ selectionBar.frame = CGRectMake(xCoor-xFromCenter/kSelectionBarSwipeConstant, selectionBar.frame.origin.y, buttonsFrameArray[currentPageIndex].size.width, selectionBar.frame.size.height)
}
}
diff --git a/SMSwipeableTabView.podspec b/SMSwipeableTabView.podspec
index bf6cb7a..748ca71 100644
--- a/SMSwipeableTabView.podspec
+++ b/SMSwipeableTabView.podspec
@@ -10,32 +10,19 @@ Pod::Spec.new do |s|
s.name = "SMSwipeableTabView"
s.version = "0.1.0"
s.summary = "Swipeable Views with Tabs (Like Android SwipeView With Tabs Layout)"
-
-# This description is used to generate tags and improve search results.
-# * Think: What does it do? Why did you write it? What is the focus?
-# * Try to keep it short, snappy and to the point.
-# * Write the description between the DESC delimiters below.
-# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
-It is a custom swipeable viewcontroller library same as Android Swipe view with Tabs Layout(In Lollipop). This control contains UIPageviewController and Scrollable SegmentBar. This type of control can be seen in Spotify app, Twitter app and in many more. User can add as many swipeable ViewController and SegmentBar Buttons. The whole control is customizable. User can easily customize the size of Button (Fixed or variable). Size, Color, Font, Height of Tabs/Segments. For more details, You can go through the example of this project.
+It is a custom swipeable viewcontroller library same as Android Swipe view with Tabs Layout(In Lollipop). This control contains UIPageviewController and Scrollable SegmentBar/TabBar. This type of control can be seen in Spotify app, Twitter app and in many more. User can add as many swipeable ViewController and SegmentBar Buttons. The whole control is customizable. User can easily customize the size of Button (Fixed or variable), Size, Color, Font, Height of Tabs/Segments. For more details, You can go through the example of this project.
DESC
-
s.homepage = "https://github.com/smahajan28/SMSwipeableTabView"
-# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author = { "Sahil Mahajan" => "sahilrameshmahajan@gmail.com" }
s.source = { :git => "https://github.com/smahajan28/SMSwipeableTabView.git", :tag => s.version.to_s }
-# s.social_media_url = 'https://twitter.com/'
-
-s.platform = :ios, '8.0'
-s.requires_arc = true
+s.platform = :ios, '7.0'
+s.requires_arc = true
-s.source_files = 'Pod/Classes/**/*'
+s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'SMSwipeableTabView' => ['Pod/Assets/*.png']
}
-# s.public_header_files = 'Pod/Classes/**/*.h'
-# s.frameworks = 'UIKit', 'MapKit'
-# s.dependency 'AFNetworking', '~> 2.3'
end
\ No newline at end of file