on master help sign in
Merge pull request #26 from Legoless/Swift3
c136918Gunay Mert Karadogan
GMStepper/GMStepper.swift+85−54
@@ -16,15 +16,22 @@ import UIKit
16 value = min(maximumValue, max(minimumValue, value))
16 value = min(maximumValue, max(minimumValue, value))
17
17
18 let isInteger = floor(value) == value
18 let isInteger = floor(value) == value
19−
19+
20+ //
21+ // If we have items, we will display them as steps
22+ //
23+
24+ if isInteger && stepValue == 1.0 && items.count > 0 {
25+ label.text = items[Int(value)]
26+ }
20− if showIntegerIfDoubleIsInteger && isInteger {
27+ else if showIntegerIfDoubleIsInteger && isInteger {
21 label.text = String(stringInterpolationSegment: Int(value))
28 label.text = String(stringInterpolationSegment: Int(value))
22 } else {
29 } else {
23 label.text = String(stringInterpolationSegment: value)
30 label.text = String(stringInterpolationSegment: value)
24 }
31 }
25
32
26 if oldValue != value {
33 if oldValue != value {
27− sendActionsForControlEvents(.ValueChanged)
34+ sendActions(for: .valueChanged)
28 }
35 }
29 }
36 }
30 }
37 }
@@ -55,22 +62,22 @@ import UIKit
55 /// Text on the left button. Be sure that it fits in the button. Defaults to "−".
62 /// Text on the left button. Be sure that it fits in the button. Defaults to "−".
56 @IBInspectable public var leftButtonText: String = "−" {
63 @IBInspectable public var leftButtonText: String = "−" {
57 didSet {
64 didSet {
58− leftButton.setTitle(leftButtonText, forState: .Normal)
65+ leftButton.setTitle(leftButtonText, for: .normal)
59 }
66 }
60 }
67 }
61
68
62 /// Text on the right button. Be sure that it fits in the button. Defaults to "+".
69 /// Text on the right button. Be sure that it fits in the button. Defaults to "+".
63 @IBInspectable public var rightButtonText: String = "+" {
70 @IBInspectable public var rightButtonText: String = "+" {
64 didSet {
71 didSet {
65− rightButton.setTitle(rightButtonText, forState: .Normal)
72+ rightButton.setTitle(rightButtonText, for: .normal)
66 }
73 }
67 }
74 }
68
75
69 /// Text color of the buttons. Defaults to white.
76 /// Text color of the buttons. Defaults to white.
70− @IBInspectable public var buttonsTextColor: UIColor = UIColor.whiteColor() {
77+ @IBInspectable public var buttonsTextColor: UIColor = UIColor.white {
71 didSet {
78 didSet {
72 for button in [leftButton, rightButton] {
79 for button in [leftButton, rightButton] {
73− button.setTitleColor(buttonsTextColor, forState: .Normal)
80+ button.setTitleColor(buttonsTextColor, for: .normal)
74 }
81 }
75 }
82 }
76 }
83 }
@@ -95,7 +102,7 @@ import UIKit
95 }
102 }
96
103
97 /// Text color of the middle label. Defaults to white.
104 /// Text color of the middle label. Defaults to white.
98− @IBInspectable public var labelTextColor: UIColor = UIColor.whiteColor() {
105+ @IBInspectable public var labelTextColor: UIColor = UIColor.white {
99 didSet {
106 didSet {
100 label.textColor = labelTextColor
107 label.textColor = labelTextColor
101 }
108 }
@@ -132,10 +139,10 @@ import UIKit
132 }
139 }
133
140
134 /// Color of the border of the stepper and middle label's layer. Defaults to clear color.
141 /// Color of the border of the stepper and middle label's layer. Defaults to clear color.
135− @IBInspectable public var borderColor: UIColor = UIColor.clearColor() {
142+ @IBInspectable public var borderColor: UIColor = UIColor.clear {
136 didSet {
143 didSet {
137− layer.borderColor = borderColor.CGColor
144+ layer.borderColor = borderColor.cgColor
138− label.layer.borderColor = borderColor.CGColor
145+ label.layer.borderColor = borderColor.cgColor
139 }
146 }
140 }
147 }
141
148
@@ -156,38 +163,38 @@ import UIKit
156 let labelSlideLength: CGFloat = 5
163 let labelSlideLength: CGFloat = 5
157
164
158 /// Duration of the sliding animation
165 /// Duration of the sliding animation
159− let labelSlideDuration = NSTimeInterval(0.1)
166+ let labelSlideDuration = TimeInterval(0.1)
160
167
161 /// Duration of the animation when the value hits the limit.
168 /// Duration of the animation when the value hits the limit.
162− let limitHitAnimationDuration = NSTimeInterval(0.1)
169+ let limitHitAnimationDuration = TimeInterval(0.1)
163
170
164 lazy var leftButton: UIButton = {
171 lazy var leftButton: UIButton = {
165 let button = UIButton()
172 let button = UIButton()
166− button.setTitle(self.leftButtonText, forState: .Normal)
173+ button.setTitle(self.leftButtonText, for: .normal)
167− button.setTitleColor(self.buttonsTextColor, forState: .Normal)
174+ button.setTitleColor(self.buttonsTextColor, for: .normal)
168 button.backgroundColor = self.buttonsBackgroundColor
175 button.backgroundColor = self.buttonsBackgroundColor
169 button.titleLabel?.font = self.buttonsFont
176 button.titleLabel?.font = self.buttonsFont
170− button.addTarget(self, action: #selector(GMStepper.leftButtonTouchDown), forControlEvents: .TouchDown)
177+ button.addTarget(self, action: #selector(GMStepper.leftButtonTouchDown), for: .touchDown)
171− button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), forControlEvents: .TouchUpInside)
178+ button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), for: .touchUpInside)
172− button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), forControlEvents: .TouchUpOutside)
179+ button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), for: .touchUpOutside)
173 return button
180 return button
174 }()
181 }()
175
182
176 lazy var rightButton: UIButton = {
183 lazy var rightButton: UIButton = {
177 let button = UIButton()
184 let button = UIButton()
178− button.setTitle(self.rightButtonText, forState: .Normal)
185+ button.setTitle(self.rightButtonText, for: .normal)
179− button.setTitleColor(self.buttonsTextColor, forState: .Normal)
186+ button.setTitleColor(self.buttonsTextColor, for: .normal)
180 button.backgroundColor = self.buttonsBackgroundColor
187 button.backgroundColor = self.buttonsBackgroundColor
181 button.titleLabel?.font = self.buttonsFont
188 button.titleLabel?.font = self.buttonsFont
182− button.addTarget(self, action: #selector(GMStepper.rightButtonTouchDown), forControlEvents: .TouchDown)
189+ button.addTarget(self, action: #selector(GMStepper.rightButtonTouchDown), for: .touchDown)
183− button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), forControlEvents: .TouchUpInside)
190+ button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), for: .touchUpInside)
184− button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), forControlEvents: .TouchUpOutside)
191+ button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), for: .touchUpOutside)
185 return button
192 return button
186 }()
193 }()
187
194
188 lazy var label: UILabel = {
195 lazy var label: UILabel = {
189 let label = UILabel()
196 let label = UILabel()
190− label.textAlignment = .Center
197+ label.textAlignment = .center
191 if self.showIntegerIfDoubleIsInteger && floor(self.value) == self.value {
198 if self.showIntegerIfDoubleIsInteger && floor(self.value) == self.value {
192 label.text = String(stringInterpolationSegment: Int(self.value))
199 label.text = String(stringInterpolationSegment: Int(self.value))
193 } else {
200 } else {
@@ -196,7 +203,7 @@ import UIKit
196 label.textColor = self.labelTextColor
203 label.textColor = self.labelTextColor
197 label.backgroundColor = self.labelBackgroundColor
204 label.backgroundColor = self.labelBackgroundColor
198 label.font = self.labelFont
205 label.font = self.labelFont
199− label.userInteractionEnabled = true
206+ label.isUserInteractionEnabled = true
200 let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(GMStepper.handlePan))
207 let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(GMStepper.handlePan))
201 panRecognizer.maximumNumberOfTouches = 1
208 panRecognizer.maximumNumberOfTouches = 1
202 label.addGestureRecognizer(panRecognizer)
209 label.addGestureRecognizer(panRecognizer)
@@ -225,9 +232,33 @@ import UIKit
225 }
232 }
226 }
233 }
227 }
234 }
235+
236+
237+ public var items : [String] = [] {
238+ didSet {
239+ let isInteger = floor(value) == value
240+
241+ //
242+ // If we have items, we will display them as steps
243+ //
244+
245+ if isInteger && stepValue == 1.0 && items.count > 0 {
246+
247+ var value = Int(self.value)
248+
249+ if value >= items.count {
250+ value = items.count - 1
251+ self.value = Double(value)
252+ }
253+ else {
254+ label.text = items[value]
255+ }
256+ }
257+ }
258+ }
228
259
229 /// Timer used for autorepeat option
260 /// Timer used for autorepeat option
230− var timer: NSTimer?
261+ var timer: Timer?
231
262
232 /** When UIStepper reaches its top speed, it alters the value with a time interval of ~0.05 sec.
263 /** When UIStepper reaches its top speed, it alters the value with a time interval of ~0.05 sec.
233 The user pressing and holding on the stepper repeatedly:
264 The user pressing and holding on the stepper repeatedly:
@@ -235,7 +266,7 @@ import UIKit
235 - For the next 1.5 sec, it changes the value every 0.1 sec.
266 - For the next 1.5 sec, it changes the value every 0.1 sec.
236 - Then, every 0.05 sec.
267 - Then, every 0.05 sec.
237 */
268 */
238− let timerInterval = NSTimeInterval(0.05)
269+ let timerInterval = TimeInterval(0.05)
239
270
240 /// Check the handleTimerFire: function. While it is counting the number of fires, it decreases the mod value so that the value is altered more frequently.
271 /// Check the handleTimerFire: function. While it is counting the number of fires, it decreases the mod value so that the value is altered more frequently.
241 var timerFireCount = 0
272 var timerFireCount = 0
@@ -268,7 +299,7 @@ import UIKit
268 layer.cornerRadius = cornerRadius
299 layer.cornerRadius = cornerRadius
269 clipsToBounds = true
300 clipsToBounds = true
270
301
271− NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(GMStepper.reset), name: UIApplicationWillResignActiveNotification, object: nil)
302+ NotificationCenter.default.addObserver(self, selector: #selector(GMStepper.reset), name: NSNotification.Name.UIApplicationWillResignActive, object: nil)
272 }
303 }
273
304
274 public override func layoutSubviews() {
305 public override func layoutSubviews() {
@@ -294,7 +325,7 @@ import UIKit
294
325
295 deinit {
326 deinit {
296 resetTimer()
327 resetTimer()
297− NSNotificationCenter.defaultCenter().removeObserver(self)
328+ NotificationCenter.default.removeObserver(self)
298 }
329 }
299
330
300 /// Useful closure for logging the timer interval. You can call this in the timer handler to test the autorepeat option. Not used in the current implementation.
331 /// Useful closure for logging the timer interval. You can call this in the timer handler to test the autorepeat option. Not used in the current implementation.
@@ -315,15 +346,15 @@ import UIKit
315extension GMStepper {
346extension GMStepper {
316 func handlePan(gesture: UIPanGestureRecognizer) {
347 func handlePan(gesture: UIPanGestureRecognizer) {
317 switch gesture.state {
348 switch gesture.state {
318− case .Began:
349+ case .began:
319− leftButton.enabled = false
350+ leftButton.isEnabled = false
320− rightButton.enabled = false
351+ rightButton.isEnabled = false
321− case .Changed:
352+ case .changed:
322− let translation = gesture.translationInView(label)
353+ let translation = gesture.translation(in: label)
323− gesture.setTranslation(CGPointZero, inView: label)
354+ gesture.setTranslation(CGPoint.zero, in: label)
324
355
325− let slidingRight = gesture.velocityInView(label).x > 0
356+ let slidingRight = gesture.velocity(in: label).x > 0
326− let slidingLeft = gesture.velocityInView(label).x < 0
357+ let slidingLeft = gesture.velocity(in: label).x < 0
327
358
328 // Move the label with pan
359 // Move the label with pan
329 if slidingRight {
360 if slidingRight {
@@ -356,7 +387,7 @@ extension GMStepper {
356 self.rightButton.backgroundColor = self.buttonsBackgroundColor
387 self.rightButton.backgroundColor = self.buttonsBackgroundColor
357 self.leftButton.backgroundColor = self.buttonsBackgroundColor
388 self.leftButton.backgroundColor = self.buttonsBackgroundColor
358 }
389 }
359− case .Ended, .Cancelled, .Failed:
390+ case .ended, .cancelled, .failed:
360 reset()
391 reset()
361 default:
392 default:
362 break
393 break
@@ -368,11 +399,11 @@ extension GMStepper {
368 stepperState = .Stable
399 stepperState = .Stable
369 resetTimer()
400 resetTimer()
370
401
371− leftButton.enabled = true
402+ leftButton.isEnabled = true
372− rightButton.enabled = true
403+ rightButton.isEnabled = true
373− label.userInteractionEnabled = true
404+ label.isUserInteractionEnabled = true
374
405
375− UIView.animateWithDuration(self.labelSlideDuration, animations: {
406+ UIView.animate(withDuration: self.labelSlideDuration, animations: {
376 self.label.center = self.labelOriginalCenter
407 self.label.center = self.labelOriginalCenter
377 self.rightButton.backgroundColor = self.buttonsBackgroundColor
408 self.rightButton.backgroundColor = self.buttonsBackgroundColor
378 self.leftButton.backgroundColor = self.buttonsBackgroundColor
409 self.leftButton.backgroundColor = self.buttonsBackgroundColor
@@ -383,8 +414,8 @@ extension GMStepper {
383// MARK: Button Events
414// MARK: Button Events
384extension GMStepper {
415extension GMStepper {
385 func leftButtonTouchDown(button: UIButton) {
416 func leftButtonTouchDown(button: UIButton) {
386− rightButton.enabled = false
417+ rightButton.isEnabled = false
387− label.userInteractionEnabled = false
418+ label.isUserInteractionEnabled = false
388 resetTimer()
419 resetTimer()
389
420
390 if value == minimumValue {
421 if value == minimumValue {
@@ -397,8 +428,8 @@ extension GMStepper {
397 }
428 }
398
429
399 func rightButtonTouchDown(button: UIButton) {
430 func rightButtonTouchDown(button: UIButton) {
400− leftButton.enabled = false
431+ leftButton.isEnabled = false
401− label.userInteractionEnabled = false
432+ label.isUserInteractionEnabled = false
402 resetTimer()
433 resetTimer()
403
434
404 if value == maximumValue {
435 if value == maximumValue {
@@ -418,20 +449,20 @@ extension GMStepper {
418extension GMStepper {
449extension GMStepper {
419
450
420 func animateSlideLeft() {
451 func animateSlideLeft() {
421− UIView.animateWithDuration(labelSlideDuration) {
452+ UIView.animate(withDuration: labelSlideDuration) {
422 self.label.center.x -= self.labelSlideLength
453 self.label.center.x -= self.labelSlideLength
423 }
454 }
424 }
455 }
425
456
426 func animateSlideRight() {
457 func animateSlideRight() {
427− UIView.animateWithDuration(labelSlideDuration) {
458+ UIView.animate(withDuration: labelSlideDuration) {
428 self.label.center.x += self.labelSlideLength
459 self.label.center.x += self.labelSlideLength
429 }
460 }
430 }
461 }
431
462
432 func animateToOriginalPosition() {
463 func animateToOriginalPosition() {
433 if self.label.center != self.labelOriginalCenter {
464 if self.label.center != self.labelOriginalCenter {
434− UIView.animateWithDuration(labelSlideDuration) {
465+ UIView.animate(withDuration: labelSlideDuration) {
435 self.label.center = self.labelOriginalCenter
466 self.label.center = self.labelOriginalCenter
436 }
467 }
437 }
468 }
@@ -439,14 +470,14 @@ extension GMStepper {
439
470
440 func animateLimitHitIfNeeded() {
471 func animateLimitHitIfNeeded() {
441 if value == minimumValue {
472 if value == minimumValue {
442− animateLimitHitForButton(leftButton)
473+ animateLimitHitForButton(button: leftButton)
443 } else if value == maximumValue {
474 } else if value == maximumValue {
444− animateLimitHitForButton(rightButton)
475+ animateLimitHitForButton(button: rightButton)
445 }
476 }
446 }
477 }
447
478
448 func animateLimitHitForButton(button: UIButton){
479 func animateLimitHitForButton(button: UIButton){
449− UIView.animateWithDuration(limitHitAnimationDuration) {
480+ UIView.animate(withDuration: limitHitAnimationDuration) {
450 button.backgroundColor = self.limitHitAnimationColor
481 button.backgroundColor = self.limitHitAnimationColor
451 }
482 }
452 }
483 }
@@ -454,7 +485,7 @@ extension GMStepper {
454
485
455// MARK: Timer
486// MARK: Timer
456extension GMStepper {
487extension GMStepper {
457− func handleTimerFire(timer: NSTimer) {
488+ func handleTimerFire(timer: Timer) {
458 timerFireCount += 1
489 timerFireCount += 1
459
490
460 if timerFireCount % timerFireCountModulo == 0 {
491 if timerFireCount % timerFireCountModulo == 0 {
@@ -463,7 +494,7 @@ extension GMStepper {
463 }
494 }
464
495
465 func scheduleTimer() {
496 func scheduleTimer() {
466− timer = NSTimer.scheduledTimerWithTimeInterval(timerInterval, target: self, selector: #selector(GMStepper.handleTimerFire), userInfo: nil, repeats: true)
497+ timer = Timer.scheduledTimer(timeInterval: timerInterval, target: self, selector: #selector(GMStepper.handleTimerFire), userInfo: nil, repeats: true)
467 }
498 }
468
499
469 func resetTimer() {
500 func resetTimer() {
GMStepperExample/GMStepperExample.xcodeproj/project.pbxproj+18−1
@@ -171,14 +171,18 @@
171 attributes = {
171 attributes = {
172 LastSwiftMigration = 0700;
172 LastSwiftMigration = 0700;
173 LastSwiftUpdateCheck = 0700;
173 LastSwiftUpdateCheck = 0700;
174− LastUpgradeCheck = 0700;
174+ LastUpgradeCheck = 0800;
175 ORGANIZATIONNAME = "Gunay Mert Karadogan";
175 ORGANIZATIONNAME = "Gunay Mert Karadogan";
176 TargetAttributes = {
176 TargetAttributes = {
177 319C19311B4843EB005EFEE5 = {
177 319C19311B4843EB005EFEE5 = {
178 CreatedOnToolsVersion = 6.4;
178 CreatedOnToolsVersion = 6.4;
179+ DevelopmentTeam = 289M6XEDV4;
180+ LastSwiftMigration = 0800;
179 };
181 };
180 319C19461B4843EB005EFEE5 = {
182 319C19461B4843EB005EFEE5 = {
181 CreatedOnToolsVersion = 6.4;
183 CreatedOnToolsVersion = 6.4;
184+ DevelopmentTeam = 289M6XEDV4;
185+ LastSwiftMigration = 0800;
182 TestTargetID = 319C19311B4843EB005EFEE5;
186 TestTargetID = 319C19311B4843EB005EFEE5;
183 };
187 };
184 };
188 };
@@ -285,8 +289,10 @@
285 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
289 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
286 CLANG_WARN_EMPTY_BODY = YES;
290 CLANG_WARN_EMPTY_BODY = YES;
287 CLANG_WARN_ENUM_CONVERSION = YES;
291 CLANG_WARN_ENUM_CONVERSION = YES;
292+ CLANG_WARN_INFINITE_RECURSION = YES;
288 CLANG_WARN_INT_CONVERSION = YES;
293 CLANG_WARN_INT_CONVERSION = YES;
289 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
294 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
295+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
290 CLANG_WARN_UNREACHABLE_CODE = YES;
296 CLANG_WARN_UNREACHABLE_CODE = YES;
291 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
297 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
292 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
298 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -330,8 +336,10 @@
330 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
336 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
331 CLANG_WARN_EMPTY_BODY = YES;
337 CLANG_WARN_EMPTY_BODY = YES;
332 CLANG_WARN_ENUM_CONVERSION = YES;
338 CLANG_WARN_ENUM_CONVERSION = YES;
339+ CLANG_WARN_INFINITE_RECURSION = YES;
333 CLANG_WARN_INT_CONVERSION = YES;
340 CLANG_WARN_INT_CONVERSION = YES;
334 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
341 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
342+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
335 CLANG_WARN_UNREACHABLE_CODE = YES;
343 CLANG_WARN_UNREACHABLE_CODE = YES;
336 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
344 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
337 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
345 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -350,6 +358,7 @@
350 IPHONEOS_DEPLOYMENT_TARGET = 8.4;
358 IPHONEOS_DEPLOYMENT_TARGET = 8.4;
351 MTL_ENABLE_DEBUG_INFO = NO;
359 MTL_ENABLE_DEBUG_INFO = NO;
352 SDKROOT = iphoneos;
360 SDKROOT = iphoneos;
361+ SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
353 VALIDATE_PRODUCT = YES;
362 VALIDATE_PRODUCT = YES;
354 };
363 };
355 name = Release;
364 name = Release;
@@ -358,10 +367,12 @@
358 isa = XCBuildConfiguration;
367 isa = XCBuildConfiguration;
359 buildSettings = {
368 buildSettings = {
360 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
369 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
370+ DEVELOPMENT_TEAM = 289M6XEDV4;
361 INFOPLIST_FILE = GMStepperExample/Info.plist;
371 INFOPLIST_FILE = GMStepperExample/Info.plist;
362 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
372 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
363 PRODUCT_BUNDLE_IDENTIFIER = "com.gunaymert.$(PRODUCT_NAME:rfc1034identifier)";
373 PRODUCT_BUNDLE_IDENTIFIER = "com.gunaymert.$(PRODUCT_NAME:rfc1034identifier)";
364 PRODUCT_NAME = "$(TARGET_NAME)";
374 PRODUCT_NAME = "$(TARGET_NAME)";
375+ SWIFT_VERSION = 3.0;
365 };
376 };
366 name = Debug;
377 name = Debug;
367 };
378 };
@@ -369,10 +380,12 @@
369 isa = XCBuildConfiguration;
380 isa = XCBuildConfiguration;
370 buildSettings = {
381 buildSettings = {
371 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
382 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
383+ DEVELOPMENT_TEAM = 289M6XEDV4;
372 INFOPLIST_FILE = GMStepperExample/Info.plist;
384 INFOPLIST_FILE = GMStepperExample/Info.plist;
373 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
385 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
374 PRODUCT_BUNDLE_IDENTIFIER = "com.gunaymert.$(PRODUCT_NAME:rfc1034identifier)";
386 PRODUCT_BUNDLE_IDENTIFIER = "com.gunaymert.$(PRODUCT_NAME:rfc1034identifier)";
375 PRODUCT_NAME = "$(TARGET_NAME)";
387 PRODUCT_NAME = "$(TARGET_NAME)";
388+ SWIFT_VERSION = 3.0;
376 };
389 };
377 name = Release;
390 name = Release;
378 };
391 };
@@ -380,6 +393,7 @@
380 isa = XCBuildConfiguration;
393 isa = XCBuildConfiguration;
381 buildSettings = {
394 buildSettings = {
382 BUNDLE_LOADER = "$(TEST_HOST)";
395 BUNDLE_LOADER = "$(TEST_HOST)";
396+ DEVELOPMENT_TEAM = 289M6XEDV4;
383 FRAMEWORK_SEARCH_PATHS = (
397 FRAMEWORK_SEARCH_PATHS = (
384 "$(SDKROOT)/Developer/Library/Frameworks",
398 "$(SDKROOT)/Developer/Library/Frameworks",
385 "$(inherited)",
399 "$(inherited)",
@@ -392,6 +406,7 @@
392 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
406 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
393 PRODUCT_BUNDLE_IDENTIFIER = "com.gunaymert.$(PRODUCT_NAME:rfc1034identifier)";
407 PRODUCT_BUNDLE_IDENTIFIER = "com.gunaymert.$(PRODUCT_NAME:rfc1034identifier)";
394 PRODUCT_NAME = "$(TARGET_NAME)";
408 PRODUCT_NAME = "$(TARGET_NAME)";
409+ SWIFT_VERSION = 3.0;
395 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GMStepperExample.app/GMStepperExample";
410 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GMStepperExample.app/GMStepperExample";
396 };
411 };
397 name = Debug;
412 name = Debug;
@@ -400,6 +415,7 @@
400 isa = XCBuildConfiguration;
415 isa = XCBuildConfiguration;
401 buildSettings = {
416 buildSettings = {
402 BUNDLE_LOADER = "$(TEST_HOST)";
417 BUNDLE_LOADER = "$(TEST_HOST)";
418+ DEVELOPMENT_TEAM = 289M6XEDV4;
403 FRAMEWORK_SEARCH_PATHS = (
419 FRAMEWORK_SEARCH_PATHS = (
404 "$(SDKROOT)/Developer/Library/Frameworks",
420 "$(SDKROOT)/Developer/Library/Frameworks",
405 "$(inherited)",
421 "$(inherited)",
@@ -408,6 +424,7 @@
408 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
424 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
409 PRODUCT_BUNDLE_IDENTIFIER = "com.gunaymert.$(PRODUCT_NAME:rfc1034identifier)";
425 PRODUCT_BUNDLE_IDENTIFIER = "com.gunaymert.$(PRODUCT_NAME:rfc1034identifier)";
410 PRODUCT_NAME = "$(TARGET_NAME)";
426 PRODUCT_NAME = "$(TARGET_NAME)";
427+ SWIFT_VERSION = 3.0;
411 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GMStepperExample.app/GMStepperExample";
428 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GMStepperExample.app/GMStepperExample";
412 };
429 };
413 name = Release;
430 name = Release;
GMStepperExample/GMStepperExample/ViewController.swift+1−1
@@ -13,7 +13,7 @@ class ViewController: UIViewController {
13 @IBOutlet weak var stepper: GMStepper!
13 @IBOutlet weak var stepper: GMStepper!
14 override func viewDidLoad() {
14 override func viewDidLoad() {
15 super.viewDidLoad()
15 super.viewDidLoad()
16− stepper.addTarget(self, action: #selector(ViewController.stepperValueChanged), forControlEvents: .ValueChanged)
16+ stepper.addTarget(self, action: #selector(ViewController.stepperValueChanged), for: .valueChanged)
17 }
17 }
18
18
19 func stepperValueChanged(stepper: GMStepper) {
19 func stepperValueChanged(stepper: GMStepper) {