├── screenshot ├── viewpager.gif └── viewpager.mov ├── ViewPager.xcodeproj ├── xcuserdata │ ├── andika.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── ViewPager.xcscheme │ └── gits.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── ViewPager ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── AppDelegate.swift ├── ViewController.swift └── ViewPager.swift ├── ViewPagerTests ├── Info.plist └── ViewPagerTests.swift ├── ViewPagerUITests ├── Info.plist └── ViewPagerUITests.swift ├── LICENSE └── README.md /screenshot/viewpager.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SeptiyanAndika/ViewPager---Swift/HEAD/screenshot/viewpager.gif -------------------------------------------------------------------------------- /screenshot/viewpager.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SeptiyanAndika/ViewPager---Swift/HEAD/screenshot/viewpager.mov -------------------------------------------------------------------------------- /ViewPager.xcodeproj/xcuserdata/andika.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /ViewPager.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ViewPager/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ViewPagerTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ViewPagerUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ViewPager.xcodeproj/xcuserdata/andika.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ViewPager.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 093484511D1FA23E0095A760 16 | 17 | primary 18 | 19 | 20 | 093484651D1FA23E0095A760 21 | 22 | primary 23 | 24 | 25 | 093484701D1FA23E0095A760 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /ViewPager.xcodeproj/xcuserdata/gits.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ViewPager.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 093484511D1FA23E0095A760 16 | 17 | primary 18 | 19 | 20 | 093484651D1FA23E0095A760 21 | 22 | primary 23 | 24 | 25 | 093484701D1FA23E0095A760 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Septiyan Andika Isanta 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /ViewPagerTests/ViewPagerTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewPagerTests.swift 3 | // ViewPagerTests 4 | // 5 | // Created by Septiyan Andika on 6/26/16. 6 | // Copyright © 2016 sailabs. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import ViewPager 11 | 12 | class ViewPagerTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ViewPager/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ViewPagerUITests/ViewPagerUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewPagerUITests.swift 3 | // ViewPagerUITests 4 | // 5 | // Created by Septiyan Andika on 6/26/16. 6 | // Copyright © 2016 sailabs. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class ViewPagerUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ViewPager/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ViewPager/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // ViewPager 4 | // 5 | // Created by Septiyan Andika on 6/26/16. 6 | // Copyright © 2016 sailabs. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /ViewPager/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SlideView 4 | // 5 | // Created by Septiyan Andika on 6/26/16. 6 | // Copyright © 2016 sailabs. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | @IBOutlet weak var viewPager: ViewPager! 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | viewPager.dataSource = self; 17 | // Do any additional setup after loading the view, typically from a nib. 18 | viewPager.animationNext() 19 | } 20 | 21 | override func viewDidAppear(animated: Bool) { 22 | super.viewDidAppear(animated) 23 | viewPager.scrollToPage(0) 24 | } 25 | 26 | override func didReceiveMemoryWarning() { 27 | super.didReceiveMemoryWarning() 28 | // Dispose of any resources that can be recreated. 29 | } 30 | } 31 | 32 | 33 | extension ViewController:ViewPagerDataSource{ 34 | func numberOfItems(viewPager:ViewPager) -> Int { 35 | return 5; 36 | } 37 | 38 | func viewAtIndex(viewPager:ViewPager, index:Int, view:UIView?) -> UIView { 39 | var newView = view; 40 | var label:UILabel? 41 | if(newView == nil){ 42 | newView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height)) 43 | newView!.backgroundColor = .randomColor() 44 | 45 | label = UILabel(frame: newView!.bounds) 46 | label!.tag = 1 47 | label!.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] 48 | label!.textAlignment = .Center 49 | label!.font = label!.font.fontWithSize(28) 50 | newView?.addSubview(label!) 51 | }else{ 52 | label = newView?.viewWithTag(1) as? UILabel 53 | } 54 | 55 | label?.text = "Page View Pager \(index+1)" 56 | 57 | return newView! 58 | } 59 | 60 | func didSelectedItem(index: Int) { 61 | print("select index \(index)") 62 | } 63 | 64 | } 65 | 66 | extension CGFloat { 67 | static func random() -> CGFloat { 68 | return CGFloat(arc4random()) / CGFloat(UInt32.max) 69 | } 70 | } 71 | 72 | 73 | extension UIColor { 74 | static func randomColor() -> UIColor { 75 | // If you wanted a random alpha, just create another 76 | // random number for that too. 77 | return UIColor(red: .random(), 78 | green: .random(), 79 | blue: .random(), 80 | alpha: 1.0) 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ViewPager---Swift 2 | An easy to use view pager library for iOS in Swift 3 | 4 | # Installation 5 | Just add ViewPager.swift file to your project, file are present inside ViewPager directory. 6 | 7 | # Preview 8 | ![Preview ](https://raw.githubusercontent.com/SeptiyanAndika/ViewPager---Swift/master/screenshot/viewpager.gif) 9 | 10 | # Setup 11 | The Viewpager follows the Apple convention for data-driven views by providing protocol interfaces ViewPagerDataSource . The ViewPagerDataSource protocol has the following required methods: 12 | 13 | func numberOfItems(viewPager:ViewPager) -> Int 14 | 15 | Return the number of items (views) in the Viewpager. 16 | 17 | func viewAtIndex(viewPager:ViewPager, index:Int, view:UIView?) -> UIView 18 | 19 | Return a view to be displayed at the specified index in the ViewPager. The `view` argument, where views that have previously been displayed in the ViewPager are passed back to the method to be recycled. If this argument is not nil, you can set its properties and return it instead of creating a new view instance, which will slightly improve performance. 20 | 21 | func didSelectedItem(index:Int) 22 | 23 | Callback when ViewPager clicked, return the number of items (views) in the Viewpager. 24 | 25 | 26 | # Example 27 | ViewController: 28 | 29 | override func viewDidLoad() { 30 | super.viewDidLoad() 31 | viewPager.dataSource = self; 32 | // Do any additional setup after loading the view, typically from a nib. 33 | } 34 | 35 | 36 | extension ViewController : 37 | 38 | extension ViewController:ViewPagerDataSource{ 39 | 40 | func numberOfItems(viewPager:ViewPager) -> Int { 41 | return 5; 42 | } 43 | 44 | func viewAtIndex(viewPager:ViewPager, index:Int, view:UIView?) -> UIView { 45 | var newView = view; 46 | var label:UILabel? 47 | if(newView == nil){ 48 | newView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height)) 49 | newView!.backgroundColor = .randomColor() 50 | 51 | label = UILabel(frame: newView!.bounds) 52 | label!.tag = 1 53 | label!.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] 54 | label!.textAlignment = .Center 55 | label!.font = label!.font.fontWithSize(28) 56 | newView?.addSubview(label!) 57 | }else{ 58 | label = newView?.viewWithTag(1) as? UILabel 59 | } 60 | 61 | label?.text = "Page View Pager \(index+1)" 62 | 63 | return newView! 64 | } 65 | } 66 | 67 | func didSelectedItem(index: Int) { 68 | print("select index \(index)") 69 | } 70 | 71 | 72 | ## License 73 | 74 | LoadingButton is available under the MIT license. See the LICENSE file for more info. 75 | 76 | 77 | -------------------------------------------------------------------------------- /ViewPager/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /ViewPager.xcodeproj/xcuserdata/andika.xcuserdatad/xcschemes/ViewPager.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /ViewPager/ViewPager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewPager.swift 3 | // ViewPager 4 | // 5 | // Created by Septiyan Andika on 6/26/16. 6 | // Copyright © 2016 sailabs. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objc public protocol ViewPagerDataSource { 12 | func numberOfItems(viewPager:ViewPager) -> Int 13 | func viewAtIndex(viewPager:ViewPager, index:Int, view:UIView?) -> UIView 14 | @objc optional func didSelectedItem(index:Int) 15 | 16 | } 17 | 18 | public class ViewPager: UIView { 19 | 20 | var pageControl:UIPageControl = UIPageControl() 21 | var scrollView:UIScrollView = UIScrollView() 22 | var currentPosition:Int = 0 23 | 24 | var dataSource:ViewPagerDataSource? = nil { 25 | didSet { 26 | reloadData() 27 | } 28 | } 29 | 30 | var numberOfItems:Int = 0 31 | var itemViews:Dictionary = [:] 32 | 33 | required public init?(coder aDecoder: NSCoder) { 34 | super.init(coder: aDecoder) 35 | setupView() 36 | } 37 | 38 | override init(frame: CGRect) { 39 | super.init(frame: frame) 40 | setupView() 41 | } 42 | 43 | func setupView() { 44 | self.addSubview(scrollView) 45 | self.addSubview(pageControl) 46 | setupScroolView(); 47 | setupPageControl(); 48 | reloadData() 49 | } 50 | 51 | func setupScroolView() { 52 | scrollView.isPagingEnabled = true; 53 | scrollView.alwaysBounceHorizontal = false 54 | scrollView.bounces = false 55 | scrollView.showsHorizontalScrollIndicator = false 56 | scrollView.showsVerticalScrollIndicator = false 57 | scrollView.delegate = self; 58 | let topContraints = NSLayoutConstraint(item: scrollView, attribute: 59 | .top, relatedBy: .equal, toItem: self, 60 | attribute: NSLayoutAttribute.top, multiplier: 1.0, 61 | constant: 0) 62 | 63 | let bottomContraints = NSLayoutConstraint(item: scrollView, attribute: 64 | .bottom, relatedBy: .equal, toItem: self, 65 | attribute: NSLayoutAttribute.bottom, multiplier: 1.0, 66 | constant: 0) 67 | 68 | let leftContraints = NSLayoutConstraint(item: scrollView, attribute: 69 | .leadingMargin, relatedBy: .equal, toItem: self, 70 | attribute: .leadingMargin, multiplier: 1.0, 71 | constant: 0) 72 | 73 | let rightContraints = NSLayoutConstraint(item: scrollView, attribute: 74 | .trailingMargin, relatedBy: .equal, toItem: self, 75 | attribute: .trailingMargin, multiplier: 1.0, 76 | constant: 0) 77 | 78 | 79 | scrollView.translatesAutoresizingMaskIntoConstraints = false 80 | NSLayoutConstraint.activate([topContraints,rightContraints,leftContraints,bottomContraints]) 81 | } 82 | 83 | func setupPageControl() { 84 | 85 | self.pageControl.numberOfPages = numberOfItems 86 | self.pageControl.currentPage = 0 87 | self.pageControl.pageIndicatorTintColor = UIColor.lightGray 88 | self.pageControl.currentPageIndicatorTintColor = UIColor.green 89 | 90 | 91 | let heightContraints = NSLayoutConstraint(item: pageControl, attribute: 92 | .height, relatedBy: .equal, toItem: nil, 93 | attribute: NSLayoutAttribute.notAnAttribute, multiplier: 1.0, 94 | constant: 25) 95 | 96 | let bottomContraints = NSLayoutConstraint(item: pageControl, attribute: 97 | .bottom, relatedBy: .equal, toItem: self, 98 | attribute: NSLayoutAttribute.bottom, multiplier: 1.0, 99 | constant: 0) 100 | 101 | let leftContraints = NSLayoutConstraint(item: pageControl, attribute: 102 | .leadingMargin, relatedBy: .equal, toItem: self, 103 | attribute: .leadingMargin, multiplier: 1.0, 104 | constant: 0) 105 | 106 | let rightContraints = NSLayoutConstraint(item: pageControl, attribute: 107 | .trailingMargin, relatedBy: .equal, toItem: self, 108 | attribute: .trailingMargin, multiplier: 1.0, 109 | constant: 0) 110 | 111 | 112 | pageControl.translatesAutoresizingMaskIntoConstraints = false 113 | NSLayoutConstraint.activate([heightContraints,rightContraints,leftContraints,bottomContraints]) 114 | } 115 | 116 | 117 | func reloadData() { 118 | if(dataSource != nil){ 119 | numberOfItems = (dataSource?.numberOfItems(viewPager: self))! 120 | } 121 | self.pageControl.numberOfPages = numberOfItems 122 | 123 | itemViews.removeAll() 124 | for view in self.scrollView.subviews { 125 | view.removeFromSuperview() 126 | } 127 | 128 | DispatchQueue.main.async { 129 | self.scrollView.contentSize = CGSize(width: self.scrollView.frame.width * CGFloat(self.numberOfItems) , height: self.scrollView.frame.height) 130 | self.reloadViews(index: 0) 131 | } 132 | } 133 | 134 | func loadViewAtIndex(index:Int){ 135 | let view:UIView? 136 | if(dataSource != nil){ 137 | view = (dataSource?.viewAtIndex(viewPager: self, index: index, view: itemViews[index]))! 138 | }else{ 139 | view = UIView() 140 | } 141 | 142 | setFrameForView(view: view!, index: index); 143 | 144 | 145 | if(itemViews[index] == nil){ 146 | itemViews[index] = view 147 | let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTapSubView)) 148 | tap.numberOfTapsRequired = 1 149 | itemViews[index]!.addGestureRecognizer(tap) 150 | 151 | scrollView.addSubview(itemViews[index]!) 152 | }else{ 153 | itemViews[index] = view 154 | } 155 | 156 | } 157 | 158 | func handleTapSubView() { 159 | if(dataSource?.didSelectedItem != nil){ 160 | dataSource?.didSelectedItem!(index: currentPosition) 161 | } 162 | } 163 | 164 | 165 | func reloadViews(index:Int){ 166 | 167 | for i in (index-1)...(index+1) { 168 | if(i>=0 && i 0) { 210 | scrollToPage(index: currentPosition) 211 | currentPosition = currentPosition + 1 212 | if currentPosition > numberOfItems { 213 | currentPosition = 1 214 | } 215 | } 216 | } 217 | 218 | func scrollToPage(index:Int) { 219 | if(index <= numberOfItems && index > 0) { 220 | let zIndex = index - 1 221 | let iframe = CGRect(x: self.scrollView.frame.width*CGFloat(zIndex), y: 0, width: self.scrollView.frame.width, height: self.scrollView.frame.height); 222 | scrollView.setContentOffset(iframe.origin, animated: true) 223 | pageControl.currentPage = zIndex 224 | reloadViews(index: zIndex) 225 | currentPosition = index 226 | } 227 | } 228 | 229 | } 230 | -------------------------------------------------------------------------------- /ViewPager.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 093484561D1FA23E0095A760 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093484551D1FA23E0095A760 /* AppDelegate.swift */; }; 11 | 093484581D1FA23E0095A760 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093484571D1FA23E0095A760 /* ViewController.swift */; }; 12 | 0934845B1D1FA23E0095A760 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 093484591D1FA23E0095A760 /* Main.storyboard */; }; 13 | 0934845D1D1FA23E0095A760 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0934845C1D1FA23E0095A760 /* Assets.xcassets */; }; 14 | 093484601D1FA23E0095A760 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0934845E1D1FA23E0095A760 /* LaunchScreen.storyboard */; }; 15 | 0934846B1D1FA23E0095A760 /* ViewPagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0934846A1D1FA23E0095A760 /* ViewPagerTests.swift */; }; 16 | 093484761D1FA23E0095A760 /* ViewPagerUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093484751D1FA23E0095A760 /* ViewPagerUITests.swift */; }; 17 | 093484841D1FA2910095A760 /* ViewPager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 093484831D1FA2910095A760 /* ViewPager.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 093484671D1FA23E0095A760 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 0934844A1D1FA23E0095A760 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 093484511D1FA23E0095A760; 26 | remoteInfo = ViewPager; 27 | }; 28 | 093484721D1FA23E0095A760 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 0934844A1D1FA23E0095A760 /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 093484511D1FA23E0095A760; 33 | remoteInfo = ViewPager; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 093484521D1FA23E0095A760 /* ViewPager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ViewPager.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 093484551D1FA23E0095A760 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40 | 093484571D1FA23E0095A760 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 41 | 0934845A1D1FA23E0095A760 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 0934845C1D1FA23E0095A760 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 0934845F1D1FA23E0095A760 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 093484611D1FA23E0095A760 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 093484661D1FA23E0095A760 /* ViewPagerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ViewPagerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 0934846A1D1FA23E0095A760 /* ViewPagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewPagerTests.swift; sourceTree = ""; }; 47 | 0934846C1D1FA23E0095A760 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 093484711D1FA23E0095A760 /* ViewPagerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ViewPagerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 093484751D1FA23E0095A760 /* ViewPagerUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewPagerUITests.swift; sourceTree = ""; }; 50 | 093484771D1FA23E0095A760 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 093484831D1FA2910095A760 /* ViewPager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewPager.swift; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 0934844F1D1FA23E0095A760 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | 093484631D1FA23E0095A760 /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | 0934846E1D1FA23E0095A760 /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXFrameworksBuildPhase section */ 77 | 78 | /* Begin PBXGroup section */ 79 | 093484491D1FA23E0095A760 = { 80 | isa = PBXGroup; 81 | children = ( 82 | 093484541D1FA23E0095A760 /* ViewPager */, 83 | 093484691D1FA23E0095A760 /* ViewPagerTests */, 84 | 093484741D1FA23E0095A760 /* ViewPagerUITests */, 85 | 093484531D1FA23E0095A760 /* Products */, 86 | ); 87 | sourceTree = ""; 88 | }; 89 | 093484531D1FA23E0095A760 /* Products */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 093484521D1FA23E0095A760 /* ViewPager.app */, 93 | 093484661D1FA23E0095A760 /* ViewPagerTests.xctest */, 94 | 093484711D1FA23E0095A760 /* ViewPagerUITests.xctest */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 093484541D1FA23E0095A760 /* ViewPager */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 093484831D1FA2910095A760 /* ViewPager.swift */, 103 | 093484551D1FA23E0095A760 /* AppDelegate.swift */, 104 | 093484571D1FA23E0095A760 /* ViewController.swift */, 105 | 093484591D1FA23E0095A760 /* Main.storyboard */, 106 | 0934845C1D1FA23E0095A760 /* Assets.xcassets */, 107 | 0934845E1D1FA23E0095A760 /* LaunchScreen.storyboard */, 108 | 093484611D1FA23E0095A760 /* Info.plist */, 109 | ); 110 | path = ViewPager; 111 | sourceTree = ""; 112 | }; 113 | 093484691D1FA23E0095A760 /* ViewPagerTests */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 0934846A1D1FA23E0095A760 /* ViewPagerTests.swift */, 117 | 0934846C1D1FA23E0095A760 /* Info.plist */, 118 | ); 119 | path = ViewPagerTests; 120 | sourceTree = ""; 121 | }; 122 | 093484741D1FA23E0095A760 /* ViewPagerUITests */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 093484751D1FA23E0095A760 /* ViewPagerUITests.swift */, 126 | 093484771D1FA23E0095A760 /* Info.plist */, 127 | ); 128 | path = ViewPagerUITests; 129 | sourceTree = ""; 130 | }; 131 | /* End PBXGroup section */ 132 | 133 | /* Begin PBXNativeTarget section */ 134 | 093484511D1FA23E0095A760 /* ViewPager */ = { 135 | isa = PBXNativeTarget; 136 | buildConfigurationList = 0934847A1D1FA23E0095A760 /* Build configuration list for PBXNativeTarget "ViewPager" */; 137 | buildPhases = ( 138 | 0934844E1D1FA23E0095A760 /* Sources */, 139 | 0934844F1D1FA23E0095A760 /* Frameworks */, 140 | 093484501D1FA23E0095A760 /* Resources */, 141 | ); 142 | buildRules = ( 143 | ); 144 | dependencies = ( 145 | ); 146 | name = ViewPager; 147 | productName = ViewPager; 148 | productReference = 093484521D1FA23E0095A760 /* ViewPager.app */; 149 | productType = "com.apple.product-type.application"; 150 | }; 151 | 093484651D1FA23E0095A760 /* ViewPagerTests */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = 0934847D1D1FA23E0095A760 /* Build configuration list for PBXNativeTarget "ViewPagerTests" */; 154 | buildPhases = ( 155 | 093484621D1FA23E0095A760 /* Sources */, 156 | 093484631D1FA23E0095A760 /* Frameworks */, 157 | 093484641D1FA23E0095A760 /* Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | 093484681D1FA23E0095A760 /* PBXTargetDependency */, 163 | ); 164 | name = ViewPagerTests; 165 | productName = ViewPagerTests; 166 | productReference = 093484661D1FA23E0095A760 /* ViewPagerTests.xctest */; 167 | productType = "com.apple.product-type.bundle.unit-test"; 168 | }; 169 | 093484701D1FA23E0095A760 /* ViewPagerUITests */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 093484801D1FA23E0095A760 /* Build configuration list for PBXNativeTarget "ViewPagerUITests" */; 172 | buildPhases = ( 173 | 0934846D1D1FA23E0095A760 /* Sources */, 174 | 0934846E1D1FA23E0095A760 /* Frameworks */, 175 | 0934846F1D1FA23E0095A760 /* Resources */, 176 | ); 177 | buildRules = ( 178 | ); 179 | dependencies = ( 180 | 093484731D1FA23E0095A760 /* PBXTargetDependency */, 181 | ); 182 | name = ViewPagerUITests; 183 | productName = ViewPagerUITests; 184 | productReference = 093484711D1FA23E0095A760 /* ViewPagerUITests.xctest */; 185 | productType = "com.apple.product-type.bundle.ui-testing"; 186 | }; 187 | /* End PBXNativeTarget section */ 188 | 189 | /* Begin PBXProject section */ 190 | 0934844A1D1FA23E0095A760 /* Project object */ = { 191 | isa = PBXProject; 192 | attributes = { 193 | LastSwiftUpdateCheck = 0730; 194 | LastUpgradeCheck = 0730; 195 | ORGANIZATIONNAME = sailabs; 196 | TargetAttributes = { 197 | 093484511D1FA23E0095A760 = { 198 | CreatedOnToolsVersion = 7.3.1; 199 | }; 200 | 093484651D1FA23E0095A760 = { 201 | CreatedOnToolsVersion = 7.3.1; 202 | TestTargetID = 093484511D1FA23E0095A760; 203 | }; 204 | 093484701D1FA23E0095A760 = { 205 | CreatedOnToolsVersion = 7.3.1; 206 | TestTargetID = 093484511D1FA23E0095A760; 207 | }; 208 | }; 209 | }; 210 | buildConfigurationList = 0934844D1D1FA23E0095A760 /* Build configuration list for PBXProject "ViewPager" */; 211 | compatibilityVersion = "Xcode 3.2"; 212 | developmentRegion = English; 213 | hasScannedForEncodings = 0; 214 | knownRegions = ( 215 | en, 216 | Base, 217 | ); 218 | mainGroup = 093484491D1FA23E0095A760; 219 | productRefGroup = 093484531D1FA23E0095A760 /* Products */; 220 | projectDirPath = ""; 221 | projectRoot = ""; 222 | targets = ( 223 | 093484511D1FA23E0095A760 /* ViewPager */, 224 | 093484651D1FA23E0095A760 /* ViewPagerTests */, 225 | 093484701D1FA23E0095A760 /* ViewPagerUITests */, 226 | ); 227 | }; 228 | /* End PBXProject section */ 229 | 230 | /* Begin PBXResourcesBuildPhase section */ 231 | 093484501D1FA23E0095A760 /* Resources */ = { 232 | isa = PBXResourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | 093484601D1FA23E0095A760 /* LaunchScreen.storyboard in Resources */, 236 | 0934845D1D1FA23E0095A760 /* Assets.xcassets in Resources */, 237 | 0934845B1D1FA23E0095A760 /* Main.storyboard in Resources */, 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | 093484641D1FA23E0095A760 /* Resources */ = { 242 | isa = PBXResourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | 0934846F1D1FA23E0095A760 /* Resources */ = { 249 | isa = PBXResourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | /* End PBXResourcesBuildPhase section */ 256 | 257 | /* Begin PBXSourcesBuildPhase section */ 258 | 0934844E1D1FA23E0095A760 /* Sources */ = { 259 | isa = PBXSourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | 093484581D1FA23E0095A760 /* ViewController.swift in Sources */, 263 | 093484561D1FA23E0095A760 /* AppDelegate.swift in Sources */, 264 | 093484841D1FA2910095A760 /* ViewPager.swift in Sources */, 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | }; 268 | 093484621D1FA23E0095A760 /* Sources */ = { 269 | isa = PBXSourcesBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | 0934846B1D1FA23E0095A760 /* ViewPagerTests.swift in Sources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | 0934846D1D1FA23E0095A760 /* Sources */ = { 277 | isa = PBXSourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | 093484761D1FA23E0095A760 /* ViewPagerUITests.swift in Sources */, 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXSourcesBuildPhase section */ 285 | 286 | /* Begin PBXTargetDependency section */ 287 | 093484681D1FA23E0095A760 /* PBXTargetDependency */ = { 288 | isa = PBXTargetDependency; 289 | target = 093484511D1FA23E0095A760 /* ViewPager */; 290 | targetProxy = 093484671D1FA23E0095A760 /* PBXContainerItemProxy */; 291 | }; 292 | 093484731D1FA23E0095A760 /* PBXTargetDependency */ = { 293 | isa = PBXTargetDependency; 294 | target = 093484511D1FA23E0095A760 /* ViewPager */; 295 | targetProxy = 093484721D1FA23E0095A760 /* PBXContainerItemProxy */; 296 | }; 297 | /* End PBXTargetDependency section */ 298 | 299 | /* Begin PBXVariantGroup section */ 300 | 093484591D1FA23E0095A760 /* Main.storyboard */ = { 301 | isa = PBXVariantGroup; 302 | children = ( 303 | 0934845A1D1FA23E0095A760 /* Base */, 304 | ); 305 | name = Main.storyboard; 306 | sourceTree = ""; 307 | }; 308 | 0934845E1D1FA23E0095A760 /* LaunchScreen.storyboard */ = { 309 | isa = PBXVariantGroup; 310 | children = ( 311 | 0934845F1D1FA23E0095A760 /* Base */, 312 | ); 313 | name = LaunchScreen.storyboard; 314 | sourceTree = ""; 315 | }; 316 | /* End PBXVariantGroup section */ 317 | 318 | /* Begin XCBuildConfiguration section */ 319 | 093484781D1FA23E0095A760 /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ALWAYS_SEARCH_USER_PATHS = NO; 323 | CLANG_ANALYZER_NONNULL = YES; 324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 325 | CLANG_CXX_LIBRARY = "libc++"; 326 | CLANG_ENABLE_MODULES = YES; 327 | CLANG_ENABLE_OBJC_ARC = YES; 328 | CLANG_WARN_BOOL_CONVERSION = YES; 329 | CLANG_WARN_CONSTANT_CONVERSION = YES; 330 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 331 | CLANG_WARN_EMPTY_BODY = YES; 332 | CLANG_WARN_ENUM_CONVERSION = YES; 333 | CLANG_WARN_INT_CONVERSION = YES; 334 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 335 | CLANG_WARN_UNREACHABLE_CODE = YES; 336 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 337 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 338 | COPY_PHASE_STRIP = NO; 339 | DEBUG_INFORMATION_FORMAT = dwarf; 340 | ENABLE_STRICT_OBJC_MSGSEND = YES; 341 | ENABLE_TESTABILITY = YES; 342 | GCC_C_LANGUAGE_STANDARD = gnu99; 343 | GCC_DYNAMIC_NO_PIC = NO; 344 | GCC_NO_COMMON_BLOCKS = YES; 345 | GCC_OPTIMIZATION_LEVEL = 0; 346 | GCC_PREPROCESSOR_DEFINITIONS = ( 347 | "DEBUG=1", 348 | "$(inherited)", 349 | ); 350 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 351 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 352 | GCC_WARN_UNDECLARED_SELECTOR = YES; 353 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 354 | GCC_WARN_UNUSED_FUNCTION = YES; 355 | GCC_WARN_UNUSED_VARIABLE = YES; 356 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 357 | MTL_ENABLE_DEBUG_INFO = YES; 358 | ONLY_ACTIVE_ARCH = YES; 359 | SDKROOT = iphoneos; 360 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 361 | }; 362 | name = Debug; 363 | }; 364 | 093484791D1FA23E0095A760 /* Release */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | ALWAYS_SEARCH_USER_PATHS = NO; 368 | CLANG_ANALYZER_NONNULL = YES; 369 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 370 | CLANG_CXX_LIBRARY = "libc++"; 371 | CLANG_ENABLE_MODULES = YES; 372 | CLANG_ENABLE_OBJC_ARC = YES; 373 | CLANG_WARN_BOOL_CONVERSION = YES; 374 | CLANG_WARN_CONSTANT_CONVERSION = YES; 375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 376 | CLANG_WARN_EMPTY_BODY = YES; 377 | CLANG_WARN_ENUM_CONVERSION = YES; 378 | CLANG_WARN_INT_CONVERSION = YES; 379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 380 | CLANG_WARN_UNREACHABLE_CODE = YES; 381 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 382 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 383 | COPY_PHASE_STRIP = NO; 384 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 385 | ENABLE_NS_ASSERTIONS = NO; 386 | ENABLE_STRICT_OBJC_MSGSEND = YES; 387 | GCC_C_LANGUAGE_STANDARD = gnu99; 388 | GCC_NO_COMMON_BLOCKS = YES; 389 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 390 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 391 | GCC_WARN_UNDECLARED_SELECTOR = YES; 392 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 393 | GCC_WARN_UNUSED_FUNCTION = YES; 394 | GCC_WARN_UNUSED_VARIABLE = YES; 395 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 396 | MTL_ENABLE_DEBUG_INFO = NO; 397 | SDKROOT = iphoneos; 398 | VALIDATE_PRODUCT = YES; 399 | }; 400 | name = Release; 401 | }; 402 | 0934847B1D1FA23E0095A760 /* Debug */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 406 | INFOPLIST_FILE = ViewPager/Info.plist; 407 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 408 | PRODUCT_BUNDLE_IDENTIFIER = com.sailabs.ViewPager; 409 | PRODUCT_NAME = "$(TARGET_NAME)"; 410 | }; 411 | name = Debug; 412 | }; 413 | 0934847C1D1FA23E0095A760 /* Release */ = { 414 | isa = XCBuildConfiguration; 415 | buildSettings = { 416 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 417 | INFOPLIST_FILE = ViewPager/Info.plist; 418 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 419 | PRODUCT_BUNDLE_IDENTIFIER = com.sailabs.ViewPager; 420 | PRODUCT_NAME = "$(TARGET_NAME)"; 421 | }; 422 | name = Release; 423 | }; 424 | 0934847E1D1FA23E0095A760 /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | buildSettings = { 427 | BUNDLE_LOADER = "$(TEST_HOST)"; 428 | INFOPLIST_FILE = ViewPagerTests/Info.plist; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 430 | PRODUCT_BUNDLE_IDENTIFIER = com.sailabs.ViewPagerTests; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ViewPager.app/ViewPager"; 433 | }; 434 | name = Debug; 435 | }; 436 | 0934847F1D1FA23E0095A760 /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | BUNDLE_LOADER = "$(TEST_HOST)"; 440 | INFOPLIST_FILE = ViewPagerTests/Info.plist; 441 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 442 | PRODUCT_BUNDLE_IDENTIFIER = com.sailabs.ViewPagerTests; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ViewPager.app/ViewPager"; 445 | }; 446 | name = Release; 447 | }; 448 | 093484811D1FA23E0095A760 /* Debug */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | INFOPLIST_FILE = ViewPagerUITests/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 453 | PRODUCT_BUNDLE_IDENTIFIER = com.sailabs.ViewPagerUITests; 454 | PRODUCT_NAME = "$(TARGET_NAME)"; 455 | TEST_TARGET_NAME = ViewPager; 456 | }; 457 | name = Debug; 458 | }; 459 | 093484821D1FA23E0095A760 /* Release */ = { 460 | isa = XCBuildConfiguration; 461 | buildSettings = { 462 | INFOPLIST_FILE = ViewPagerUITests/Info.plist; 463 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 464 | PRODUCT_BUNDLE_IDENTIFIER = com.sailabs.ViewPagerUITests; 465 | PRODUCT_NAME = "$(TARGET_NAME)"; 466 | TEST_TARGET_NAME = ViewPager; 467 | }; 468 | name = Release; 469 | }; 470 | /* End XCBuildConfiguration section */ 471 | 472 | /* Begin XCConfigurationList section */ 473 | 0934844D1D1FA23E0095A760 /* Build configuration list for PBXProject "ViewPager" */ = { 474 | isa = XCConfigurationList; 475 | buildConfigurations = ( 476 | 093484781D1FA23E0095A760 /* Debug */, 477 | 093484791D1FA23E0095A760 /* Release */, 478 | ); 479 | defaultConfigurationIsVisible = 0; 480 | defaultConfigurationName = Release; 481 | }; 482 | 0934847A1D1FA23E0095A760 /* Build configuration list for PBXNativeTarget "ViewPager" */ = { 483 | isa = XCConfigurationList; 484 | buildConfigurations = ( 485 | 0934847B1D1FA23E0095A760 /* Debug */, 486 | 0934847C1D1FA23E0095A760 /* Release */, 487 | ); 488 | defaultConfigurationIsVisible = 0; 489 | }; 490 | 0934847D1D1FA23E0095A760 /* Build configuration list for PBXNativeTarget "ViewPagerTests" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | 0934847E1D1FA23E0095A760 /* Debug */, 494 | 0934847F1D1FA23E0095A760 /* Release */, 495 | ); 496 | defaultConfigurationIsVisible = 0; 497 | }; 498 | 093484801D1FA23E0095A760 /* Build configuration list for PBXNativeTarget "ViewPagerUITests" */ = { 499 | isa = XCConfigurationList; 500 | buildConfigurations = ( 501 | 093484811D1FA23E0095A760 /* Debug */, 502 | 093484821D1FA23E0095A760 /* Release */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | }; 506 | /* End XCConfigurationList section */ 507 | }; 508 | rootObject = 0934844A1D1FA23E0095A760 /* Project object */; 509 | } 510 | --------------------------------------------------------------------------------