├── what.gif
├── SlideControlDemo.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
├── xcuserdata
│ └── dom.xcuserdatad
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── SlideControlDemo.xcscheme
└── project.pbxproj
├── README.md
├── SlideControlDemo
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── Base.lproj
│ ├── Main.storyboard
│ └── LaunchScreen.storyboard
├── ViewController.swift
├── AppDelegate.swift
└── DHSlideControl.swift
├── .gitignore
├── LICENCE
└── DHSlideControl.swift
/what.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dasdom/SlideControl/HEAD/what.gif
--------------------------------------------------------------------------------
/SlideControlDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SlideControlDemo.xcodeproj/xcuserdata/dom.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | SlideControlDemo.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | F2E2E0BD1BA2ECC0003CD3E9
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SlideControl
2 | Vertical slide control build with Swift 2.0
3 |
4 | 
5 |
6 | ## How to use
7 |
8 | Add DHSlideControl.swift to your project. Use it in your project like this:
9 |
10 | ```swift
11 | let titles = ["1st Option", "2nd Option", "3rd Option", "4th Option"]
12 |
13 | let slideControl = DHSlideControl(titles: titles)
14 | slideControl.translatesAutoresizingMaskIntoConstraints = false
15 | slideControl.addTarget(self, action: "didChange:", forControlEvents: .ValueChanged)
16 | slideControl.color = UIColor(hue: 0.6, saturation: 0.9, brightness: 0.65, alpha: 1.0)
17 | slideControl.layer.cornerRadius = 10
18 | ```
19 |
20 | ## Licence
21 |
22 | This code is released unter MIT licence. See licence file for details.
23 |
--------------------------------------------------------------------------------
/SlideControlDemo/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 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io/api/swift
2 |
3 | ### Swift ###
4 | # Xcode
5 | #
6 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
7 |
8 | ## Build generated
9 | build/
10 | DerivedData
11 |
12 | ## Various settings
13 | *.pbxuser
14 | !default.pbxuser
15 | *.mode1v3
16 | !default.mode1v3
17 | *.mode2v3
18 | !default.mode2v3
19 | *.perspectivev3
20 | !default.perspectivev3
21 | xcuserdata
22 |
23 | ## Other
24 | *.xccheckout
25 | *.moved-aside
26 | *.xcuserstate
27 | *.xcscmblueprint
28 |
29 | ## Obj-C/Swift specific
30 | *.hmap
31 | *.ipa
32 |
33 | # CocoaPods
34 | #
35 | # We recommend against adding the Pods directory to your .gitignore. However
36 | # you should judge for yourself, the pros and cons are mentioned at:
37 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
38 | #
39 | # Pods/
40 |
41 | # Carthage
42 | #
43 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
44 | # Carthage/Checkouts
45 |
46 | Carthage/Build
47 |
48 |
--------------------------------------------------------------------------------
/LICENCE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Dominik Hauser
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/SlideControlDemo/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 |
--------------------------------------------------------------------------------
/SlideControlDemo/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 |
--------------------------------------------------------------------------------
/SlideControlDemo/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // SlideControlDemo
4 | //
5 | // Created by dasdom on 11.09.15.
6 | // Copyright © 2015 Dominik Hauser. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController {
12 |
13 | var label: UILabel?
14 | let titles = ["1st Option", "2nd Option", "3rd Option", "4th Option"]
15 |
16 | override func viewDidLoad() {
17 | super.viewDidLoad()
18 |
19 | let slideControl = DHSlideControl(titles: titles)
20 | slideControl.translatesAutoresizingMaskIntoConstraints = false
21 | slideControl.addTarget(self, action: "didChange:", forControlEvents: .ValueChanged)
22 | slideControl.color = UIColor(hue: 0.6, saturation: 0.9, brightness: 0.65, alpha: 1.0)
23 | slideControl.layer.cornerRadius = 10
24 |
25 | label = UILabel()
26 | label?.translatesAutoresizingMaskIntoConstraints = false
27 | label?.text = titles.first
28 | label?.textAlignment = .Center
29 |
30 | view.addSubview(slideControl)
31 | view.addSubview(label!)
32 |
33 | let views = ["slide": slideControl, "label": label!]
34 | var layoutConstraints = [NSLayoutConstraint]()
35 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("|-20-[slide]-20-|", options: [], metrics: nil, views: views)
36 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("V:|-50-[slide(80)]-50-[label]", options: [.AlignAllLeading, .AlignAllTrailing], metrics: nil, views: views)
37 | NSLayoutConstraint.activateConstraints(layoutConstraints)
38 |
39 | }
40 |
41 | func didChange(sender: DHSlideControl) {
42 | print(sender.selectedIndex)
43 | label?.text = titles[sender.selectedIndex]
44 | }
45 |
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/SlideControlDemo/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 |
--------------------------------------------------------------------------------
/SlideControlDemo/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // SlideControlDemo
4 | //
5 | // Created by dasdom on 11.09.15.
6 | // Copyright © 2015 Dominik Hauser. 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 |
--------------------------------------------------------------------------------
/SlideControlDemo.xcodeproj/xcuserdata/dom.xcuserdatad/xcschemes/SlideControlDemo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/DHSlideControl.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DHSlideControl.swift
3 | // SlideControlDemo
4 | //
5 | // Created by dasdom on 11.09.15.
6 | // Copyright © 2015 Dominik Hauser. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class DHSlideControl: UIControl {
12 |
13 | var selectedIndex: Int
14 | var titles = [String]()
15 |
16 | var color: UIColor? {
17 | didSet {
18 | backgroundColor = color
19 | if let color = color {
20 | rightGradientLayer.colors = [color.colorWithAlphaComponent(0.1).CGColor, color.CGColor]
21 | leftGradientLayer.colors = [color.colorWithAlphaComponent(0.1).CGColor, color.CGColor]
22 | }
23 | tintColor = color
24 | }
25 | }
26 |
27 | private let scrollView: UIScrollView
28 | private let labelHostView: UIView
29 | private var rightBlendView: UIView
30 | private let leftBlendView: UIView
31 | private let leftGradientLayer: CAGradientLayer
32 | private let rightGradientLayer: CAGradientLayer
33 |
34 | private var xOffsetAtStart: CGFloat?
35 |
36 | init(titles: [String]) {
37 | scrollView = UIScrollView()
38 | scrollView.translatesAutoresizingMaskIntoConstraints = false
39 | scrollView.pagingEnabled = true
40 | scrollView.clipsToBounds = false
41 | scrollView.decelerationRate = UIScrollViewDecelerationRateFast
42 | scrollView.showsHorizontalScrollIndicator = false
43 |
44 | labelHostView = UIView()
45 | labelHostView.translatesAutoresizingMaskIntoConstraints = false
46 |
47 | let controllColor = UIColor(hue: 0.6, saturation: 0.5, brightness: 0.7, alpha: 1.0)
48 | rightBlendView = UIView()
49 | rightBlendView.translatesAutoresizingMaskIntoConstraints = false
50 | rightGradientLayer = CAGradientLayer()
51 | rightGradientLayer.colors = [controllColor.colorWithAlphaComponent(0.1).CGColor, controllColor.CGColor]
52 | rightGradientLayer.startPoint = CGPoint(x: 1.0, y: 0.5)
53 | rightGradientLayer.endPoint = CGPoint(x: 0.2, y: 0.5)
54 | rightBlendView.layer.addSublayer(rightGradientLayer)
55 |
56 | leftBlendView = UIView()
57 | leftBlendView.translatesAutoresizingMaskIntoConstraints = false
58 | leftGradientLayer = CAGradientLayer()
59 | leftGradientLayer.colors = [controllColor.colorWithAlphaComponent(0.1).CGColor, controllColor.CGColor]
60 | leftGradientLayer.startPoint = CGPoint(x: 0.0, y: 0.5)
61 | leftGradientLayer.endPoint = CGPoint(x: 0.8, y: 0.5)
62 | leftBlendView.layer.addSublayer(leftGradientLayer)
63 |
64 | selectedIndex = 0
65 |
66 | super.init(frame: .zero)
67 | backgroundColor = controllColor
68 | tintColor = controllColor
69 | clipsToBounds = true
70 |
71 | self.titles = titles
72 | scrollView.delegate = self
73 | addGestureRecognizer(UIPanGestureRecognizer(target: self, action: "didPan:"))
74 |
75 | let imageView = UIImageView(image: triangleImage(controllColor))
76 | imageView.translatesAutoresizingMaskIntoConstraints = false
77 |
78 | addSubview(scrollView)
79 | scrollView.addSubview(labelHostView)
80 | addSubview(rightBlendView)
81 | addSubview(leftBlendView)
82 | addSubview(imageView)
83 |
84 | var layoutConstraints = [NSLayoutConstraint]()
85 |
86 | var previousLabel: UILabel?
87 | for (index, string) in titles.enumerate() {
88 | let label = UILabel()
89 | label.translatesAutoresizingMaskIntoConstraints = false
90 | labelHostView.addSubview(label)
91 | label.text = string
92 | label.textAlignment = .Center
93 | label.backgroundColor = .whiteColor()
94 |
95 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("V:|-20-[label]-20-|", options: [], metrics: nil, views: ["label": label])
96 |
97 | if previousLabel == nil {
98 | layoutConstraints.append(label.leadingAnchor.constraintEqualToAnchor(labelHostView.leadingAnchor))
99 | } else {
100 | layoutConstraints.append(label.leadingAnchor.constraintEqualToAnchor(previousLabel?.trailingAnchor))
101 | layoutConstraints.append(label.widthAnchor.constraintEqualToAnchor(previousLabel?.widthAnchor))
102 | }
103 | previousLabel = label
104 |
105 | if index == titles.count-1 {
106 | layoutConstraints.append(label.trailingAnchor.constraintEqualToAnchor(labelHostView.trailingAnchor))
107 | }
108 | }
109 |
110 | let views = ["scrollView": scrollView, "host": labelHostView, "right": rightBlendView, "left": leftBlendView]
111 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("|[right(70)][scrollView][left(70)]|", options: [.AlignAllTop, .AlignAllBottom], metrics: nil, views: views)
112 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("V:|[scrollView]|", options: [], metrics: nil, views: views)
113 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("|[host]|", options: [], metrics: nil, views: views)
114 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("V:|[host]|", options: [], metrics: nil, views: views)
115 | layoutConstraints.append(imageView.centerXAnchor.constraintEqualToAnchor(centerXAnchor))
116 | layoutConstraints.append(imageView.centerYAnchor.constraintEqualToAnchor(centerYAnchor, constant: 20))
117 | NSLayoutConstraint.activateConstraints(layoutConstraints)
118 |
119 | }
120 |
121 | required init?(coder aDecoder: NSCoder) {
122 | fatalError("init(coder:) has not been implemented")
123 | }
124 |
125 | override func layoutSubviews() {
126 | super.layoutSubviews()
127 |
128 | print(scrollView.frame)
129 | labelHostView.widthAnchor.constraintEqualToConstant(CGFloat(titles.count)*scrollView.frame.size.width).active = true
130 | labelHostView.heightAnchor.constraintEqualToConstant(scrollView.frame.size.height).active = true
131 |
132 | leftGradientLayer.frame = leftBlendView.bounds
133 | rightGradientLayer.frame = rightBlendView.bounds
134 | }
135 |
136 | func didPan(sender: UIPanGestureRecognizer) {
137 | let xTranslation = sender.translationInView(self).x
138 |
139 | switch sender.state {
140 | case .Began:
141 | xOffsetAtStart = scrollView.contentOffset.x
142 | case .Changed:
143 | if let xOffsetAtStart = xOffsetAtStart {
144 | scrollView.setContentOffset(CGPoint(x: -xTranslation + xOffsetAtStart, y: 0), animated: false)
145 | }
146 | case .Ended:
147 | xOffsetAtStart = nil
148 | let widthOfLabel = floor(scrollView.contentSize.width/CGFloat(titles.count))
149 | print(scrollView.contentOffset.x/widthOfLabel)
150 | let offset = max(min(round(scrollView.contentOffset.x/widthOfLabel), CGFloat(titles.count-1)), 0.0)*widthOfLabel
151 |
152 | scrollView.setContentOffset(CGPoint(x: offset, y: 0), animated: true)
153 | // let xVelocity = sender.velocityInView(self).x
154 | //
155 | // print(offset-scrollView.contentOffset.x)
156 | //// Double(abs(offset-scrollView.contentOffset.x)/50.0)
157 | // UIView.animateWithDuration(0.5, delay: 0.0, usingSpringWithDamping: 1.0, initialSpringVelocity: xVelocity/30, options: [], animations: { () -> Void in
158 | // self.scrollView.contentOffset.x = offset
159 | // }, completion: nil)
160 | default:
161 | break
162 | }
163 | }
164 |
165 | func triangleImage(color: UIColor) -> UIImage {
166 |
167 | UIGraphicsBeginImageContextWithOptions(CGSizeMake(240, 120), false, 0)
168 | let polygonPath = UIBezierPath()
169 | polygonPath.moveToPoint(CGPointMake(118, 55))
170 | polygonPath.addLineToPoint(CGPointMake(152, 77))
171 | polygonPath.addLineToPoint(CGPointMake(84, 77))
172 | polygonPath.closePath()
173 | color.setFill()
174 | polygonPath.fill()
175 |
176 | let image = UIGraphicsGetImageFromCurrentImageContext()!
177 | UIGraphicsEndImageContext()
178 |
179 | return image.imageWithRenderingMode(.AlwaysTemplate)
180 | }
181 |
182 | }
183 |
184 | extension DHSlideControl : UIScrollViewDelegate {
185 | func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
186 | let widthOfLabel = floor(scrollView.contentSize.width/CGFloat(titles.count))
187 | selectedIndex = Int(round(scrollView.contentOffset.x/widthOfLabel))
188 | sendActionsForControlEvents(.ValueChanged)
189 | }
190 |
191 | func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
192 | if !decelerate {
193 | let widthOfLabel = floor(scrollView.contentSize.width/CGFloat(titles.count))
194 | selectedIndex = Int(round(scrollView.contentOffset.x/widthOfLabel))
195 | sendActionsForControlEvents(.ValueChanged)
196 | }
197 | }
198 | }
199 |
--------------------------------------------------------------------------------
/SlideControlDemo/DHSlideControl.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DHSlideControl.swift
3 | // SlideControlDemo
4 | //
5 | // Created by dasdom on 11.09.15.
6 | // Copyright © 2015 Dominik Hauser. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class DHSlideControl: UIControl {
12 |
13 | var selectedIndex: Int
14 | var titles = [String]()
15 |
16 | var color: UIColor? {
17 | didSet {
18 | backgroundColor = color
19 | if let color = color {
20 | rightGradientLayer.colors = [color.colorWithAlphaComponent(0.1).CGColor, color.CGColor]
21 | leftGradientLayer.colors = [color.colorWithAlphaComponent(0.1).CGColor, color.CGColor]
22 | }
23 | tintColor = color
24 | }
25 | }
26 |
27 | private let scrollView: UIScrollView
28 | private let labelHostView: UIView
29 | private var rightBlendView: UIView
30 | private let leftBlendView: UIView
31 | private let leftGradientLayer: CAGradientLayer
32 | private let rightGradientLayer: CAGradientLayer
33 |
34 | private var xOffsetAtStart: CGFloat?
35 |
36 | init(titles: [String]) {
37 | scrollView = UIScrollView()
38 | scrollView.translatesAutoresizingMaskIntoConstraints = false
39 | scrollView.pagingEnabled = true
40 | scrollView.clipsToBounds = false
41 | scrollView.decelerationRate = UIScrollViewDecelerationRateFast
42 | scrollView.showsHorizontalScrollIndicator = false
43 |
44 | labelHostView = UIView()
45 | labelHostView.translatesAutoresizingMaskIntoConstraints = false
46 |
47 | let controllColor = UIColor(hue: 0.6, saturation: 0.5, brightness: 0.7, alpha: 1.0)
48 | rightBlendView = UIView()
49 | rightBlendView.translatesAutoresizingMaskIntoConstraints = false
50 | rightGradientLayer = CAGradientLayer()
51 | rightGradientLayer.colors = [controllColor.colorWithAlphaComponent(0.1).CGColor, controllColor.CGColor]
52 | rightGradientLayer.startPoint = CGPoint(x: 1.0, y: 0.5)
53 | rightGradientLayer.endPoint = CGPoint(x: 0.2, y: 0.5)
54 | rightBlendView.layer.addSublayer(rightGradientLayer)
55 |
56 | leftBlendView = UIView()
57 | leftBlendView.translatesAutoresizingMaskIntoConstraints = false
58 | leftGradientLayer = CAGradientLayer()
59 | leftGradientLayer.colors = [controllColor.colorWithAlphaComponent(0.1).CGColor, controllColor.CGColor]
60 | leftGradientLayer.startPoint = CGPoint(x: 0.0, y: 0.5)
61 | leftGradientLayer.endPoint = CGPoint(x: 0.8, y: 0.5)
62 | leftBlendView.layer.addSublayer(leftGradientLayer)
63 |
64 | selectedIndex = 0
65 |
66 | super.init(frame: .zero)
67 | backgroundColor = controllColor
68 | tintColor = controllColor
69 | clipsToBounds = true
70 |
71 | self.titles = titles
72 | scrollView.delegate = self
73 | addGestureRecognizer(UIPanGestureRecognizer(target: self, action: "didPan:"))
74 |
75 | let imageView = UIImageView(image: triangleImage(controllColor))
76 | imageView.translatesAutoresizingMaskIntoConstraints = false
77 |
78 | addSubview(scrollView)
79 | scrollView.addSubview(labelHostView)
80 | addSubview(rightBlendView)
81 | addSubview(leftBlendView)
82 | addSubview(imageView)
83 |
84 | var layoutConstraints = [NSLayoutConstraint]()
85 |
86 | var previousLabel: UILabel?
87 | for (index, string) in titles.enumerate() {
88 | let label = UILabel()
89 | label.translatesAutoresizingMaskIntoConstraints = false
90 | labelHostView.addSubview(label)
91 | label.text = string
92 | label.textAlignment = .Center
93 | label.backgroundColor = .whiteColor()
94 |
95 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("V:|-20-[label]-20-|", options: [], metrics: nil, views: ["label": label])
96 |
97 | if previousLabel == nil {
98 | layoutConstraints.append(label.leadingAnchor.constraintEqualToAnchor(labelHostView.leadingAnchor))
99 | } else {
100 | layoutConstraints.append(label.leadingAnchor.constraintEqualToAnchor(previousLabel?.trailingAnchor))
101 | layoutConstraints.append(label.widthAnchor.constraintEqualToAnchor(previousLabel?.widthAnchor))
102 | }
103 | previousLabel = label
104 |
105 | if index == titles.count-1 {
106 | layoutConstraints.append(label.trailingAnchor.constraintEqualToAnchor(labelHostView.trailingAnchor))
107 | }
108 | }
109 |
110 | let views = ["scrollView": scrollView, "host": labelHostView, "right": rightBlendView, "left": leftBlendView]
111 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("|[right(70)][scrollView][left(70)]|", options: [.AlignAllTop, .AlignAllBottom], metrics: nil, views: views)
112 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("V:|[scrollView]|", options: [], metrics: nil, views: views)
113 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("|[host]|", options: [], metrics: nil, views: views)
114 | layoutConstraints += NSLayoutConstraint.constraintsWithVisualFormat("V:|[host]|", options: [], metrics: nil, views: views)
115 | layoutConstraints.append(imageView.centerXAnchor.constraintEqualToAnchor(centerXAnchor))
116 | layoutConstraints.append(imageView.centerYAnchor.constraintEqualToAnchor(centerYAnchor, constant: 20))
117 | NSLayoutConstraint.activateConstraints(layoutConstraints)
118 |
119 | }
120 |
121 | required init?(coder aDecoder: NSCoder) {
122 | fatalError("init(coder:) has not been implemented")
123 | }
124 |
125 | override func layoutSubviews() {
126 | super.layoutSubviews()
127 |
128 | // print(scrollView.frame)
129 | labelHostView.widthAnchor.constraintEqualToConstant(CGFloat(titles.count)*scrollView.frame.size.width).active = true
130 | labelHostView.heightAnchor.constraintEqualToConstant(scrollView.frame.size.height).active = true
131 |
132 | leftGradientLayer.frame = leftBlendView.bounds
133 | rightGradientLayer.frame = rightBlendView.bounds
134 | }
135 |
136 | func didPan(sender: UIPanGestureRecognizer) {
137 | let xTranslation = sender.translationInView(self).x
138 |
139 | switch sender.state {
140 | case .Began:
141 | xOffsetAtStart = scrollView.contentOffset.x
142 | case .Changed:
143 | if let xOffsetAtStart = xOffsetAtStart {
144 | scrollView.setContentOffset(CGPoint(x: -xTranslation + xOffsetAtStart, y: 0), animated: false)
145 | }
146 | case .Ended:
147 | xOffsetAtStart = nil
148 | let widthOfLabel = floor(scrollView.contentSize.width/CGFloat(titles.count))
149 | // print(scrollView.contentOffset.x/widthOfLabel)
150 | let offset = max(min(round(scrollView.contentOffset.x/widthOfLabel), CGFloat(titles.count-1)), 0.0)*widthOfLabel
151 |
152 | // scrollView.setContentOffset(CGPoint(x: offset, y: 0), animated: true)
153 | // let xVelocity = sender.velocityInView(self).x
154 | //
155 | // print(offset-scrollView.contentOffset.x)
156 | //// Double(abs(offset-scrollView.contentOffset.x)/50.0)
157 | // UIView.animateWithDuration(0.5, delay: 0.0, usingSpringWithDamping: 1.0, initialSpringVelocity: xVelocity/30, options: [], animations: { () -> Void in
158 | // self.scrollView.contentOffset.x = offset
159 | // }, completion: nil)
160 |
161 | UIView.animateWithDuration(0.5, animations: { () -> Void in
162 | self.scrollView.setContentOffset(CGPoint(x: offset, y: 0), animated: false)
163 | }, completion: { (_) -> Void in
164 | self.scrollViewDidEndDecelerating(self.scrollView)
165 | })
166 |
167 | default:
168 | break
169 | }
170 | }
171 |
172 | func triangleImage(color: UIColor) -> UIImage {
173 |
174 | UIGraphicsBeginImageContextWithOptions(CGSizeMake(240, 120), false, 0)
175 | let polygonPath = UIBezierPath()
176 | polygonPath.moveToPoint(CGPointMake(118, 55))
177 | polygonPath.addLineToPoint(CGPointMake(152, 77))
178 | polygonPath.addLineToPoint(CGPointMake(84, 77))
179 | polygonPath.closePath()
180 | color.setFill()
181 | polygonPath.fill()
182 |
183 | let image = UIGraphicsGetImageFromCurrentImageContext()!
184 | UIGraphicsEndImageContext()
185 |
186 | return image.imageWithRenderingMode(.AlwaysTemplate)
187 | }
188 |
189 | }
190 |
191 | extension DHSlideControl : UIScrollViewDelegate {
192 | func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
193 | let widthOfLabel = floor(scrollView.contentSize.width/CGFloat(titles.count))
194 | selectedIndex = Int(round(scrollView.contentOffset.x/widthOfLabel))
195 | sendActionsForControlEvents(.ValueChanged)
196 | }
197 |
198 | func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
199 | if !decelerate {
200 | let widthOfLabel = floor(scrollView.contentSize.width/CGFloat(titles.count))
201 | selectedIndex = Int(round(scrollView.contentOffset.x/widthOfLabel))
202 | sendActionsForControlEvents(.ValueChanged)
203 | }
204 | }
205 | }
206 |
--------------------------------------------------------------------------------
/SlideControlDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | F26414ED1BB48F46000EB3E7 /* DHSlideControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = F26414EC1BB48F46000EB3E7 /* DHSlideControl.swift */; settings = {ASSET_TAGS = (); }; };
11 | F2E2E0C21BA2ECC1003CD3E9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2E2E0C11BA2ECC1003CD3E9 /* AppDelegate.swift */; };
12 | F2E2E0C41BA2ECC1003CD3E9 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2E2E0C31BA2ECC1003CD3E9 /* ViewController.swift */; };
13 | F2E2E0C71BA2ECC1003CD3E9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F2E2E0C51BA2ECC1003CD3E9 /* Main.storyboard */; };
14 | F2E2E0C91BA2ECC1003CD3E9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F2E2E0C81BA2ECC1003CD3E9 /* Assets.xcassets */; };
15 | F2E2E0CC1BA2ECC1003CD3E9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F2E2E0CA1BA2ECC1003CD3E9 /* LaunchScreen.storyboard */; };
16 | /* End PBXBuildFile section */
17 |
18 | /* Begin PBXFileReference section */
19 | F26414EC1BB48F46000EB3E7 /* DHSlideControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DHSlideControl.swift; sourceTree = ""; };
20 | F2E2E0BE1BA2ECC0003CD3E9 /* SlideControlDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SlideControlDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
21 | F2E2E0C11BA2ECC1003CD3E9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
22 | F2E2E0C31BA2ECC1003CD3E9 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
23 | F2E2E0C61BA2ECC1003CD3E9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
24 | F2E2E0C81BA2ECC1003CD3E9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
25 | F2E2E0CB1BA2ECC1003CD3E9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
26 | F2E2E0CD1BA2ECC1003CD3E9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
27 | /* End PBXFileReference section */
28 |
29 | /* Begin PBXFrameworksBuildPhase section */
30 | F2E2E0BB1BA2ECC0003CD3E9 /* Frameworks */ = {
31 | isa = PBXFrameworksBuildPhase;
32 | buildActionMask = 2147483647;
33 | files = (
34 | );
35 | runOnlyForDeploymentPostprocessing = 0;
36 | };
37 | /* End PBXFrameworksBuildPhase section */
38 |
39 | /* Begin PBXGroup section */
40 | F2E2E0B51BA2ECC0003CD3E9 = {
41 | isa = PBXGroup;
42 | children = (
43 | F2E2E0C01BA2ECC0003CD3E9 /* SlideControlDemo */,
44 | F2E2E0BF1BA2ECC0003CD3E9 /* Products */,
45 | );
46 | sourceTree = "";
47 | };
48 | F2E2E0BF1BA2ECC0003CD3E9 /* Products */ = {
49 | isa = PBXGroup;
50 | children = (
51 | F2E2E0BE1BA2ECC0003CD3E9 /* SlideControlDemo.app */,
52 | );
53 | name = Products;
54 | sourceTree = "";
55 | };
56 | F2E2E0C01BA2ECC0003CD3E9 /* SlideControlDemo */ = {
57 | isa = PBXGroup;
58 | children = (
59 | F2E2E0C11BA2ECC1003CD3E9 /* AppDelegate.swift */,
60 | F2E2E0C31BA2ECC1003CD3E9 /* ViewController.swift */,
61 | F26414EC1BB48F46000EB3E7 /* DHSlideControl.swift */,
62 | F2E2E0C51BA2ECC1003CD3E9 /* Main.storyboard */,
63 | F2E2E0C81BA2ECC1003CD3E9 /* Assets.xcassets */,
64 | F2E2E0CA1BA2ECC1003CD3E9 /* LaunchScreen.storyboard */,
65 | F2E2E0CD1BA2ECC1003CD3E9 /* Info.plist */,
66 | );
67 | path = SlideControlDemo;
68 | sourceTree = "";
69 | };
70 | /* End PBXGroup section */
71 |
72 | /* Begin PBXNativeTarget section */
73 | F2E2E0BD1BA2ECC0003CD3E9 /* SlideControlDemo */ = {
74 | isa = PBXNativeTarget;
75 | buildConfigurationList = F2E2E0D01BA2ECC1003CD3E9 /* Build configuration list for PBXNativeTarget "SlideControlDemo" */;
76 | buildPhases = (
77 | F2E2E0BA1BA2ECC0003CD3E9 /* Sources */,
78 | F2E2E0BB1BA2ECC0003CD3E9 /* Frameworks */,
79 | F2E2E0BC1BA2ECC0003CD3E9 /* Resources */,
80 | );
81 | buildRules = (
82 | );
83 | dependencies = (
84 | );
85 | name = SlideControlDemo;
86 | productName = SlideControlDemo;
87 | productReference = F2E2E0BE1BA2ECC0003CD3E9 /* SlideControlDemo.app */;
88 | productType = "com.apple.product-type.application";
89 | };
90 | /* End PBXNativeTarget section */
91 |
92 | /* Begin PBXProject section */
93 | F2E2E0B61BA2ECC0003CD3E9 /* Project object */ = {
94 | isa = PBXProject;
95 | attributes = {
96 | LastUpgradeCheck = 0700;
97 | ORGANIZATIONNAME = "Dominik Hauser";
98 | TargetAttributes = {
99 | F2E2E0BD1BA2ECC0003CD3E9 = {
100 | CreatedOnToolsVersion = 7.0;
101 | };
102 | };
103 | };
104 | buildConfigurationList = F2E2E0B91BA2ECC0003CD3E9 /* Build configuration list for PBXProject "SlideControlDemo" */;
105 | compatibilityVersion = "Xcode 3.2";
106 | developmentRegion = English;
107 | hasScannedForEncodings = 0;
108 | knownRegions = (
109 | en,
110 | Base,
111 | );
112 | mainGroup = F2E2E0B51BA2ECC0003CD3E9;
113 | productRefGroup = F2E2E0BF1BA2ECC0003CD3E9 /* Products */;
114 | projectDirPath = "";
115 | projectRoot = "";
116 | targets = (
117 | F2E2E0BD1BA2ECC0003CD3E9 /* SlideControlDemo */,
118 | );
119 | };
120 | /* End PBXProject section */
121 |
122 | /* Begin PBXResourcesBuildPhase section */
123 | F2E2E0BC1BA2ECC0003CD3E9 /* Resources */ = {
124 | isa = PBXResourcesBuildPhase;
125 | buildActionMask = 2147483647;
126 | files = (
127 | F2E2E0CC1BA2ECC1003CD3E9 /* LaunchScreen.storyboard in Resources */,
128 | F2E2E0C91BA2ECC1003CD3E9 /* Assets.xcassets in Resources */,
129 | F2E2E0C71BA2ECC1003CD3E9 /* Main.storyboard in Resources */,
130 | );
131 | runOnlyForDeploymentPostprocessing = 0;
132 | };
133 | /* End PBXResourcesBuildPhase section */
134 |
135 | /* Begin PBXSourcesBuildPhase section */
136 | F2E2E0BA1BA2ECC0003CD3E9 /* Sources */ = {
137 | isa = PBXSourcesBuildPhase;
138 | buildActionMask = 2147483647;
139 | files = (
140 | F2E2E0C41BA2ECC1003CD3E9 /* ViewController.swift in Sources */,
141 | F2E2E0C21BA2ECC1003CD3E9 /* AppDelegate.swift in Sources */,
142 | F26414ED1BB48F46000EB3E7 /* DHSlideControl.swift in Sources */,
143 | );
144 | runOnlyForDeploymentPostprocessing = 0;
145 | };
146 | /* End PBXSourcesBuildPhase section */
147 |
148 | /* Begin PBXVariantGroup section */
149 | F2E2E0C51BA2ECC1003CD3E9 /* Main.storyboard */ = {
150 | isa = PBXVariantGroup;
151 | children = (
152 | F2E2E0C61BA2ECC1003CD3E9 /* Base */,
153 | );
154 | name = Main.storyboard;
155 | sourceTree = "";
156 | };
157 | F2E2E0CA1BA2ECC1003CD3E9 /* LaunchScreen.storyboard */ = {
158 | isa = PBXVariantGroup;
159 | children = (
160 | F2E2E0CB1BA2ECC1003CD3E9 /* Base */,
161 | );
162 | name = LaunchScreen.storyboard;
163 | sourceTree = "";
164 | };
165 | /* End PBXVariantGroup section */
166 |
167 | /* Begin XCBuildConfiguration section */
168 | F2E2E0CE1BA2ECC1003CD3E9 /* Debug */ = {
169 | isa = XCBuildConfiguration;
170 | buildSettings = {
171 | ALWAYS_SEARCH_USER_PATHS = NO;
172 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
173 | CLANG_CXX_LIBRARY = "libc++";
174 | CLANG_ENABLE_MODULES = YES;
175 | CLANG_ENABLE_OBJC_ARC = YES;
176 | CLANG_WARN_BOOL_CONVERSION = YES;
177 | CLANG_WARN_CONSTANT_CONVERSION = YES;
178 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
179 | CLANG_WARN_EMPTY_BODY = YES;
180 | CLANG_WARN_ENUM_CONVERSION = YES;
181 | CLANG_WARN_INT_CONVERSION = YES;
182 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
183 | CLANG_WARN_UNREACHABLE_CODE = YES;
184 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
185 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
186 | COPY_PHASE_STRIP = NO;
187 | DEBUG_INFORMATION_FORMAT = dwarf;
188 | ENABLE_STRICT_OBJC_MSGSEND = YES;
189 | ENABLE_TESTABILITY = YES;
190 | GCC_C_LANGUAGE_STANDARD = gnu99;
191 | GCC_DYNAMIC_NO_PIC = NO;
192 | GCC_NO_COMMON_BLOCKS = YES;
193 | GCC_OPTIMIZATION_LEVEL = 0;
194 | GCC_PREPROCESSOR_DEFINITIONS = (
195 | "DEBUG=1",
196 | "$(inherited)",
197 | );
198 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
199 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
200 | GCC_WARN_UNDECLARED_SELECTOR = YES;
201 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
202 | GCC_WARN_UNUSED_FUNCTION = YES;
203 | GCC_WARN_UNUSED_VARIABLE = YES;
204 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
205 | MTL_ENABLE_DEBUG_INFO = YES;
206 | ONLY_ACTIVE_ARCH = YES;
207 | SDKROOT = iphoneos;
208 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
209 | };
210 | name = Debug;
211 | };
212 | F2E2E0CF1BA2ECC1003CD3E9 /* Release */ = {
213 | isa = XCBuildConfiguration;
214 | buildSettings = {
215 | ALWAYS_SEARCH_USER_PATHS = NO;
216 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
217 | CLANG_CXX_LIBRARY = "libc++";
218 | CLANG_ENABLE_MODULES = YES;
219 | CLANG_ENABLE_OBJC_ARC = YES;
220 | CLANG_WARN_BOOL_CONVERSION = YES;
221 | CLANG_WARN_CONSTANT_CONVERSION = YES;
222 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
223 | CLANG_WARN_EMPTY_BODY = YES;
224 | CLANG_WARN_ENUM_CONVERSION = YES;
225 | CLANG_WARN_INT_CONVERSION = YES;
226 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
227 | CLANG_WARN_UNREACHABLE_CODE = YES;
228 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
229 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
230 | COPY_PHASE_STRIP = NO;
231 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
232 | ENABLE_NS_ASSERTIONS = NO;
233 | ENABLE_STRICT_OBJC_MSGSEND = YES;
234 | GCC_C_LANGUAGE_STANDARD = gnu99;
235 | GCC_NO_COMMON_BLOCKS = YES;
236 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
237 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
238 | GCC_WARN_UNDECLARED_SELECTOR = YES;
239 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
240 | GCC_WARN_UNUSED_FUNCTION = YES;
241 | GCC_WARN_UNUSED_VARIABLE = YES;
242 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
243 | MTL_ENABLE_DEBUG_INFO = NO;
244 | SDKROOT = iphoneos;
245 | VALIDATE_PRODUCT = YES;
246 | };
247 | name = Release;
248 | };
249 | F2E2E0D11BA2ECC1003CD3E9 /* Debug */ = {
250 | isa = XCBuildConfiguration;
251 | buildSettings = {
252 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
253 | INFOPLIST_FILE = SlideControlDemo/Info.plist;
254 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
255 | PRODUCT_BUNDLE_IDENTIFIER = com.swiftandpainless.SlideControlDemo;
256 | PRODUCT_NAME = "$(TARGET_NAME)";
257 | };
258 | name = Debug;
259 | };
260 | F2E2E0D21BA2ECC1003CD3E9 /* Release */ = {
261 | isa = XCBuildConfiguration;
262 | buildSettings = {
263 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
264 | INFOPLIST_FILE = SlideControlDemo/Info.plist;
265 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
266 | PRODUCT_BUNDLE_IDENTIFIER = com.swiftandpainless.SlideControlDemo;
267 | PRODUCT_NAME = "$(TARGET_NAME)";
268 | };
269 | name = Release;
270 | };
271 | /* End XCBuildConfiguration section */
272 |
273 | /* Begin XCConfigurationList section */
274 | F2E2E0B91BA2ECC0003CD3E9 /* Build configuration list for PBXProject "SlideControlDemo" */ = {
275 | isa = XCConfigurationList;
276 | buildConfigurations = (
277 | F2E2E0CE1BA2ECC1003CD3E9 /* Debug */,
278 | F2E2E0CF1BA2ECC1003CD3E9 /* Release */,
279 | );
280 | defaultConfigurationIsVisible = 0;
281 | defaultConfigurationName = Release;
282 | };
283 | F2E2E0D01BA2ECC1003CD3E9 /* Build configuration list for PBXNativeTarget "SlideControlDemo" */ = {
284 | isa = XCConfigurationList;
285 | buildConfigurations = (
286 | F2E2E0D11BA2ECC1003CD3E9 /* Debug */,
287 | F2E2E0D21BA2ECC1003CD3E9 /* Release */,
288 | );
289 | defaultConfigurationIsVisible = 0;
290 | defaultConfigurationName = Release;
291 | };
292 | /* End XCConfigurationList section */
293 | };
294 | rootObject = F2E2E0B61BA2ECC0003CD3E9 /* Project object */;
295 | }
296 |
--------------------------------------------------------------------------------