From f1111a2febe8b0a361229c39f986a7e35cea1258 Mon Sep 17 00:00:00 2001 From: Thiha Aung Date: Wed, 15 Mar 2017 01:09:12 +0630 Subject: [PATCH] Swift 3 Updated. Some modification changed. --- .DS_Store | Bin 0 -> 6148 bytes BubbleControl-Swift.xcodeproj/project.pbxproj | 38 ++- .../UserInterfaceState.xcuserstate | Bin 0 -> 18404 bytes .../xcschemes/BubbleControl-Swift.xcscheme | 101 +++++++ .../xcschemes/xcschememanagement.plist | 27 ++ BubbleControl-Swift/AppDelegate.swift | 33 +- .../Base.lproj/Main.storyboard | 49 +-- BubbleControl-Swift/BubbleControl.swift | 282 ++++++++---------- .../AppIcon.appiconset/Contents.json | 25 ++ BubbleControl-Swift/Info.plist | 2 +- BubbleControl-Swift/ViewController.swift | 242 ++++++++------- BubbleControl-SwiftTests/Info.plist | 2 +- 12 files changed, 483 insertions(+), 318 deletions(-) create mode 100644 .DS_Store create mode 100644 BubbleControl-Swift.xcodeproj/project.xcworkspace/xcuserdata/Htarwara6245.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 BubbleControl-Swift.xcodeproj/xcuserdata/Htarwara6245.xcuserdatad/xcschemes/BubbleControl-Swift.xcscheme create mode 100644 BubbleControl-Swift.xcodeproj/xcuserdata/Htarwara6245.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..56993136f55141683a8bb34bdd988f783291574f GIT binary patch literal 6148 zcmeHKOHRW;41H6&C}Ptk8>G1aNWH-*gcIZf6$xK8Btnf~8Hwv~9PYrXci?$EDy;&m zNC=P}*>B<*JDE3990PD!S1o`!fEiVAa!B)q$h_!4Cdo4;x|m~yE1aXj1J;Ap=J<^a z$l0ABLx)RVyXW`Fb6nvR1)gw+Yo6#Co>9_U@swN0{Qc@?QIt*H>ee=4T(-K&^Qv2y zz}x2iHRc@gZgo?AW_uZ%t-amZsawW$W{d%2z!>USdI^c~2}8nOkuwyhp+pUJsl{*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9V5K|y4NGZs&ud=VU-(ufn-)`S+f873({T2IB z`w9C=`&;&R?WgTu+t1j)xBqBAZ~xi;Yf)O!n4+$t+l%^(wioRw+E;YA=-Hx|iry>w zpy+hb*F|TFzAO5rSX3-2jxSCqPAX0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BubbleControl-Swift.xcodeproj/xcuserdata/Htarwara6245.xcuserdatad/xcschemes/xcschememanagement.plist b/BubbleControl-Swift.xcodeproj/xcuserdata/Htarwara6245.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..53212bf --- /dev/null +++ b/BubbleControl-Swift.xcodeproj/xcuserdata/Htarwara6245.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + BubbleControl-Swift.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + B27A54351A39953B00F18798 + + primary + + + B27A544A1A39953B00F18798 + + primary + + + + + diff --git a/BubbleControl-Swift/AppDelegate.swift b/BubbleControl-Swift/AppDelegate.swift index 16eba36..9be6b96 100644 --- a/BubbleControl-Swift/AppDelegate.swift +++ b/BubbleControl-Swift/AppDelegate.swift @@ -2,19 +2,44 @@ // AppDelegate.swift // BubbleControl-Swift // -// Created by Cem Olcay on 11/12/14. -// Copyright (c) 2014 Cem Olcay. All rights reserved. +// Created by Thiha Aung on 3/14/17. +// Copyright © 2017 Imagination. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { - + var window: UIWindow? - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. return true } + + func applicationWillResignActive(_ application: UIApplication) { + // 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. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // 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. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // 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. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + } diff --git a/BubbleControl-Swift/Base.lproj/Main.storyboard b/BubbleControl-Swift/Base.lproj/Main.storyboard index 6e75ae0..3949386 100644 --- a/BubbleControl-Swift/Base.lproj/Main.storyboard +++ b/BubbleControl-Swift/Base.lproj/Main.storyboard @@ -1,9 +1,13 @@ - - + + + + + - + + @@ -15,82 +19,85 @@ - + - + - + - + - + + + + @@ -106,7 +113,7 @@ - + @@ -117,14 +124,14 @@ - + - + - + diff --git a/BubbleControl-Swift/BubbleControl.swift b/BubbleControl-Swift/BubbleControl.swift index 6728c51..e2f5143 100644 --- a/BubbleControl-Swift/BubbleControl.swift +++ b/BubbleControl-Swift/BubbleControl.swift @@ -2,27 +2,22 @@ // BubbleControl.swift // BubbleControl-Swift // -// Created by Cem Olcay on 11/12/14. -// Copyright (c) 2014 Cem Olcay. All rights reserved. +// Created by Thiha Aung on 3/14/17. +// Copyright © 2017 Imagination. All rights reserved. // import UIKit +import Foundation -let APPDELEGATE: AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate - - +let APPDELEGATE: AppDelegate = UIApplication.shared.delegate as! AppDelegate // MARK: - Animation Constants - -private let BubbleControlMoveAnimationDuration: NSTimeInterval = 0.5 +private let BubbleControlMoveAnimationDuration: TimeInterval = 0.5 private let BubbleControlSpringDamping: CGFloat = 0.6 private let BubbleControlSpringVelocity: CGFloat = 0.6 - // MARK: - UIView Extension - -extension UIView { - +extension UIView : CAAnimationDelegate{ // MARK: Frame Extensions @@ -128,14 +123,14 @@ extension UIView { - func spring (animations: ()->Void, completion:((Bool)->Void)?) { - UIView.animateWithDuration(BubbleControlMoveAnimationDuration, - delay: 0, - usingSpringWithDamping: BubbleControlSpringDamping, - initialSpringVelocity: BubbleControlSpringVelocity, - options: UIViewAnimationOptions.CurveEaseInOut, - animations: animations, - completion: completion) + func spring (animations: @escaping ()->Void, completion:((Bool)->Void)?) { + UIView.animate(withDuration: BubbleControlMoveAnimationDuration, + delay: 0, + usingSpringWithDamping: BubbleControlSpringDamping, + initialSpringVelocity: BubbleControlSpringVelocity, + options: UIViewAnimationOptions.curveEaseInOut, + animations: animations, + completion: completion) } @@ -143,18 +138,18 @@ extension UIView { var moveRect = self.frame moveRect.origin.y = y - spring({ () -> Void in + spring(animations: { () -> Void in self.frame = moveRect - }, completion: nil) + }, completion: nil) } func moveX (x: CGFloat) { var moveRect = self.frame moveRect.origin.x = x - spring({ () -> Void in + spring(animations: { () -> Void in self.frame = moveRect - }, completion: nil) + }, completion: nil) } func movePoint (x: CGFloat, y: CGFloat) { @@ -162,18 +157,18 @@ extension UIView { moveRect.origin.x = x moveRect.origin.y = y - spring({ () -> Void in + spring(animations: { () -> Void in self.frame = moveRect - }, completion: nil) + }, completion: nil) } func movePoint (point: CGPoint) { var moveRect = self.frame moveRect.origin = point - spring({ () -> Void in + spring(animations: { () -> Void in self.frame = moveRect - }, completion: nil) + }, completion: nil) } @@ -186,32 +181,29 @@ extension UIView { } func alphaTo (to: CGFloat) { - UIView.animateWithDuration(BubbleControlMoveAnimationDuration, - animations: { - self.alpha = to + UIView.animate(withDuration: BubbleControlMoveAnimationDuration, + animations: { + self.alpha = to }) } func bubble () { - - self.setScale(1.2) - spring({ () -> Void in - self.setScale(1) - }, completion: nil) + self.setScale(s: 1.2) + spring(animations: { () -> Void in + self.setScale(s: 1) + }, completion: nil) } } // MARK: - BubbleControl - class BubbleControl: UIControl { - // MARK: Constants - let popTriggerDuration: NSTimeInterval = 0.5 - let popAnimationDuration: NSTimeInterval = 1 - let popAnimationShakeDuration: NSTimeInterval = 0.10 + let popTriggerDuration: TimeInterval = 0.5 + let popAnimationDuration: TimeInterval = 1 + let popAnimationShakeDuration: TimeInterval = 0.10 let popAnimationShakeRotations: (CGFloat, CGFloat) = (-30, 30) let popAnimationScale: CGFloat = 1.2 @@ -219,7 +211,6 @@ class BubbleControl: UIControl { let snapOffsetMax: CGFloat = 50 - // MARK: Optionals var contentView: UIView? @@ -229,16 +220,14 @@ class BubbleControl: UIControl { var movesBottom: Bool = false - // MARK: Actions var didToggle: ((Bool) -> ())? var didNavigationBarButtonPressed: (() -> ())? var didPop: (()->())? - var setOpenAnimation: ((contentView: UIView, backgroundView: UIView?)->())? - var setCloseAnimation: ((contentView: UIView, backgroundView: UIView?) -> ())? - + var setOpenAnimation: ((_ contentView: UIView, _ backgroundView: UIView?)->())? + var setCloseAnimation: ((_ contentView: UIView, _ backgroundView: UIView?) -> ())? // MARK: Bubble State @@ -261,14 +250,12 @@ class BubbleControl: UIControl { } - // MARK: Snap private var snapOffset: CGFloat! - private var snapInTimer: NSTimer? - private var snapInInterval: NSTimeInterval = 2 - + private var snapInTimer: Timer? + private var snapInInterval: TimeInterval = 2 // MARK: Toggle @@ -287,13 +274,11 @@ class BubbleControl: UIControl { } - // MARK: Navigation Button private var barButtonItem: UIBarButtonItem? - // MARK: Badge private var badgeLabel: UILabel? @@ -303,19 +288,18 @@ class BubbleControl: UIControl { if badgeCount < 0 { badgeCount = 0 } else if badgeCount > 0 { - badgeLabel?.hidden = false + badgeLabel?.isHidden = false badgeLabel?.text = "\(badgeCount)" badgeLabel?.bubble() } else { - badgeLabel?.hidden = true + badgeLabel?.isHidden = true } - barButtonItem?.setBadgeValue(badgeCount) + barButtonItem?.setBadgeValue(value: badgeCount) } } - // MARK: Image var imageView: UIImageView? @@ -326,23 +310,22 @@ class BubbleControl: UIControl { } - // MARK: Init init (size: CGSize) { - super.init(frame: CGRect (origin: CGPointZero, size: size)) + super.init(frame: CGRect (origin: CGPoint.zero, size: size)) defaultInit() } init (image: UIImage) { let size = image.size - super.init(frame: CGRect (origin: CGPointZero, size: size)) + super.init(frame: CGRect (origin: CGPoint.zero, size: size)) self.image = image defaultInit() } - required init(coder aDecoder: NSCoder) { + required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } @@ -353,28 +336,25 @@ class BubbleControl: UIControl { snapOffset = snapOffsetMin layer.cornerRadius = w/2 - // image view - imageView = UIImageView (frame: CGRectInset(frame, 20, 20)) + imageView = UIImageView (frame: frame.insetBy(dx: 20, dy: 20)) addSubview(imageView!) - // circle border let borderView = UIView (frame: frame) - borderView.layer.borderColor = UIColor.blackColor().CGColor + borderView.layer.borderColor = UIColor.black.cgColor borderView.layer.borderWidth = 2 borderView.layer.cornerRadius = w/2 borderView.layer.masksToBounds = true - borderView.userInteractionEnabled = false + borderView.isUserInteractionEnabled = false addSubview(borderView) - // badge label - badgeLabel = UILabel (frame: CGRectInset(frame, 25, 25)) - badgeLabel?.center = CGPointMake(left + badgeLabel!.w/2, top + badgeLabel!.h/2) - badgeLabel?.backgroundColor = UIColor.redColor() - badgeLabel?.textAlignment = NSTextAlignment.Center - badgeLabel?.textColor = UIColor.whiteColor() + badgeLabel = UILabel (frame: frame.insetBy(dx: 25, dy: 25)) + badgeLabel?.center = CGPoint(x:(left + badgeLabel!.w/2), y: (top + badgeLabel!.h/2)) + badgeLabel?.backgroundColor = UIColor.red + badgeLabel?.textAlignment = NSTextAlignment.center + badgeLabel?.textColor = UIColor.white badgeLabel?.text = "\(badgeCount)" badgeLabel?.layer.cornerRadius = badgeLabel!.w/2 badgeLabel?.layer.masksToBounds = true @@ -382,17 +362,15 @@ class BubbleControl: UIControl { badgeCount = 0 - // events - addTarget(self, action: "touchDown", forControlEvents: UIControlEvents.TouchDown) - addTarget(self, action: "touchUp", forControlEvents: UIControlEvents.TouchUpInside) - addTarget(self, action: "touchDrag:event:", forControlEvents: UIControlEvents.TouchDragInside) + addTarget(self, action: #selector(BubbleControl.touchDown), for: UIControlEvents.touchDown) + addTarget(self, action: #selector(BubbleControl.touchUp), for: UIControlEvents.touchUpInside) + addTarget(self, action: #selector(BubbleControl.touchDrag(sender:event:)), for: UIControlEvents.touchDragInside) - var longPress = UILongPressGestureRecognizer (target: self, action: "longPressHandler:") + let longPress = UILongPressGestureRecognizer (target: self, action: #selector(BubbleControl.longPressHandler(press:))) longPress.minimumPressDuration = 0.75 addGestureRecognizer(longPress) - // place center.x = APPDELEGATE.window!.w - w/2 + snapOffset center.y = 84 + h/2 @@ -400,30 +378,28 @@ class BubbleControl: UIControl { } - // MARK: Snap To Edge func snap () { let window = APPDELEGATE.window! // if control on left side - var targetX = window.leftWithOffset(snapOffset) + var targetX = window.leftWithOffset(offset: snapOffset) var badgeTargetX = w - badgeLabel!.w - // if control on right side if center.x > window.w/2 { - targetX = window.rightWithOffset(snapOffset) - w + targetX = window.rightWithOffset(offset: snapOffset) - w badgeTargetX = 0 } // move to snap position - moveX(targetX) - badgeLabel!.moveX(badgeTargetX) + moveX(x: targetX) + badgeLabel!.moveX(x: badgeTargetX) } func snapInside () { - println("snap inside !") + print("snap inside !") if !toggle && bubbleState == .Snap { snapOffset = snapOffsetMax snap() @@ -436,16 +412,16 @@ class BubbleControl: UIControl { } if let timer = snapInTimer { - if timer.valid { + if timer.isValid { timer.invalidate() } } - snapInTimer = NSTimer.scheduledTimerWithTimeInterval(snapInInterval, - target: self, - selector: Selector("snapInside"), - userInfo: nil, - repeats: false) + snapInTimer = Timer.scheduledTimer(timeInterval: snapInInterval, + target: self, + selector: #selector(BubbleControl.snapInside), + userInfo: nil, + repeats: false) } @@ -467,19 +443,18 @@ class BubbleControl: UIControl { if bottom > window.h { var rect = frame - rect.origin.y = window.botttomWithOffset(-h) + rect.origin.y = window.botttomWithOffset(offset: -h) frame = rect } if right > window.w { var rect = frame - rect.origin.x = window.rightWithOffset(-w) + rect.origin.x = window.rightWithOffset(offset: -w) frame = rect } } - // MARK: Events func touchDown () { @@ -502,8 +477,8 @@ class BubbleControl: UIControl { toggle = false } - let touch = event.allTouches()!.first! as! UITouch - let location = touch.locationInView(APPDELEGATE.window!) + let touch = event.allTouches!.first! + let location = touch.location(in: APPDELEGATE.window!) center = location lockInWindowBounds() @@ -517,9 +492,9 @@ class BubbleControl: UIControl { } switch press.state { - case .Began: + case .began: pop() - case .Ended: + case .ended: if bubbleState == .Pop { cancelPop() } @@ -533,22 +508,21 @@ class BubbleControl: UIControl { } - // MARK: Animations - override func animationDidStop(anim: CAAnimation!, - finished flag: Bool) { - if flag { - if anim == layer.animationForKey("pop") { - layer.removeAnimationForKey("pop") - - didPop? () - - if popsToNavBar { - popToNavBar() - } + func animationDidStop(anim: CAAnimation!, + finished flag: Bool) { + if flag { + if anim == layer.animation(forKey: "pop") { + layer.removeAnimation(forKey: "pop") + + didPop? () + + if popsToNavBar { + popToNavBar() } } + } } func degreesToRadians (angle: CGFloat) -> CGFloat { @@ -556,115 +530,113 @@ class BubbleControl: UIControl { } - // MARK: Pop - func pop () { + func pop() { bubbleState = .Pop snap() let shake = CABasicAnimation(keyPath: "transform.rotation") - shake.fromValue = degreesToRadians(popAnimationShakeRotations.0) - shake.toValue = degreesToRadians(popAnimationShakeRotations.1) + shake.fromValue = degreesToRadians(angle: popAnimationShakeRotations.0) + shake.toValue = degreesToRadians(angle: popAnimationShakeRotations.1) shake.duration = popAnimationShakeDuration shake.repeatCount = Float.infinity shake.autoreverses = true - let grow = CABasicAnimation (keyPath: "transform.scale") + let grow = CABasicAnimation(keyPath: "transform.scale") grow.fromValue = 1 grow.toValue = popAnimationScale grow.duration = popAnimationDuration - let anims = CAAnimationGroup () + let anims = CAAnimationGroup() anims.animations = [shake, grow] anims.duration = popAnimationDuration anims.delegate = self - anims.removedOnCompletion = false + anims.isRemovedOnCompletion = false - layer.addAnimation(anims, forKey: "pop") + layer.add(anims, forKey: "pop") } func cancelPop () { snap() - layer.removeAnimationForKey("pop") + layer.removeAnimation(forKey: "pop") } func popToNavBar () { bubbleState = .NavBar - spring({ () -> Void in - self.setScale(0) + spring(animations: { () -> Void in + self.setScale(s: 0) self.alpha = 0.5 - }, completion: { finished in - self.setScale(1) - self.hidden = true + }, completion: { finished in + self.setScale(s: 1) + self.isHidden = true }) var barButton: UIBarButtonItem? - if let img = image { + if image != nil { let navButton = UIButton (frame: CGRect (x: 0, y: 0, width: 20, height: 20)) - navButton.setBackgroundImage(image!, forState: .Normal) - navButton.addTarget(self, action: "navButtonPressed:", - forControlEvents: .TouchUpInside) + navButton.setBackgroundImage(image!, for: .normal) + navButton.addTarget(self, action: #selector(BubbleControl.navButtonPressed(sender:)), + for: .touchUpInside) barButton = UIBarButtonItem (customView: navButton) } else { - barButton = UIBarButtonItem (barButtonSystemItem: UIBarButtonSystemItem.Action - , target: self, action: "navButtonPressed:") + barButton = UIBarButtonItem (barButtonSystemItem: UIBarButtonSystemItem.action + , target: self, action : #selector(BubbleControl.navButtonPressed(sender:))) } barButtonItem = barButton - barButtonItem?.setBadgeValue(badgeCount) + barButtonItem?.setBadgeValue(value: badgeCount) if let last = APPDELEGATE.window!.rootViewController as? UINavigationController { - let vc = last.viewControllers[0] as! UIViewController - vc.navigationItem.setRightBarButtonItem(barButtonItem!, animated: true) + let vc = last.viewControllers[0] + vc.navigationItem.setRightBarButton(barButtonItem!, animated: true) } } func popFromNavBar () { if let last = APPDELEGATE.window!.rootViewController as? UINavigationController { - let vc = last.viewControllers[0] as! UIViewController + let vc = last.viewControllers[0] vc.navigationItem.rightBarButtonItem = nil bubbleState = .Snap self.barButtonItem = nil - self.hidden = false + self.isHidden = false let toPosition = self.frame.origin self.position = CGPoint(x: APPDELEGATE.window!.right, y: APPDELEGATE.window!.top) - self.movePoint(toPosition) - self.alphaTo(1) + self.movePoint(point: toPosition) + self.alphaTo(to: 1) } } - // MARK: Toggle func openContentView () { if let v = contentView { let win = APPDELEGATE.window! win.addSubview(v) - win.bringSubviewToFront(self) + win.bringSubview(toFront: self) snapOffset = snapOffsetMin snap() positionBeforeToggle = frame.origin if let anim = setOpenAnimation { - anim (contentView: v, backgroundView: win.subviews[0] as? UIView) + anim (v, win.subviews[0] as UIView) } else { v.bottom = win.bottom } if movesBottom { - movePoint(CGPoint (x: win.center.x - w/2, y: win.bottom - h - snapOffset)) + movePoint(point: CGPoint (x: win.center.x - w/2, y: win.bottom - h - snapOffset)) } else { - moveY(v.top - h - snapOffset) + moveY(y: v.top - h - snapOffset) } } } @@ -673,23 +645,20 @@ class BubbleControl: UIControl { if let v = contentView { if let anim = setCloseAnimation { - anim (contentView: v, backgroundView: APPDELEGATE.window?.subviews[0] as? UIView) + anim (v, (APPDELEGATE.window?.subviews[0])!) } else { v.removeFromSuperview() } if (bubbleState == .Snap) { setupSnapInsideTimer() - movePoint(positionBeforeToggle!) + movePoint(point: positionBeforeToggle!) } } } } - - // MARK: - UIBarButtonItem Badge Extension - private var barButtonAssociatedObjectBadge: UInt8 = 0 extension UIBarButtonItem { @@ -697,42 +666,41 @@ extension UIBarButtonItem { get { return objc_getAssociatedObject(self, &barButtonAssociatedObjectBadge) as! UILabel? } set (value) { - objc_setAssociatedObject(self, &barButtonAssociatedObjectBadge, value, UInt(OBJC_ASSOCIATION_RETAIN)) + objc_setAssociatedObject(self, &barButtonAssociatedObjectBadge, value, objc_AssociationPolicy(rawValue: UInt(objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN.rawValue))!) } } func setBadgeValue (value: Int) { - println("value \(value)") + print("value \(value)") if let label = badgeLabel { if value > 0 { - label.hidden = false + label.isHidden = false label.text = "\(value)" label.bubble() } else { - label.hidden = true + label.isHidden = true } } else { - let view = valueForKey("view") as? UIView + let view = self.value(forKey: "view") as? UIView badgeLabel = UILabel (frame: CGRect (x: 0, y: 0, width: 20, height: 20)) - badgeLabel?.center = CGPoint (x: view!.right, y: view!.top) - badgeLabel?.backgroundColor = UIColor.redColor() + badgeLabel?.center = CGPoint (x: (view?.right)!, y: (view?.top)!) + badgeLabel?.backgroundColor = UIColor.red badgeLabel?.layer.cornerRadius = badgeLabel!.h/2 badgeLabel?.layer.masksToBounds = true - badgeLabel?.textAlignment = NSTextAlignment.Center - badgeLabel?.textColor = UIColor.whiteColor() - badgeLabel?.font = UIFont.systemFontOfSize(15) + badgeLabel?.textAlignment = NSTextAlignment.center + badgeLabel?.textColor = UIColor.white + badgeLabel?.font = UIFont.systemFont(ofSize: 15) badgeLabel?.text = "\(value)" if value == 0 { - badgeLabel?.hidden = true + badgeLabel?.isHidden = true } view?.addSubview(badgeLabel!) } } } - diff --git a/BubbleControl-Swift/Images.xcassets/AppIcon.appiconset/Contents.json b/BubbleControl-Swift/Images.xcassets/AppIcon.appiconset/Contents.json index 36d2c80..1d060ed 100644 --- a/BubbleControl-Swift/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/BubbleControl-Swift/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -59,6 +79,11 @@ "idiom" : "ipad", "size" : "76x76", "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" } ], "info" : { diff --git a/BubbleControl-Swift/Info.plist b/BubbleControl-Swift/Info.plist index a31c69a..40c6215 100644 --- a/BubbleControl-Swift/Info.plist +++ b/BubbleControl-Swift/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.questa.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/BubbleControl-Swift/ViewController.swift b/BubbleControl-Swift/ViewController.swift index 57535ff..7ddd7a7 100644 --- a/BubbleControl-Swift/ViewController.swift +++ b/BubbleControl-Swift/ViewController.swift @@ -2,33 +2,31 @@ // ViewController.swift // BubbleControl-Swift // -// Created by Cem Olcay on 11/12/14. -// Copyright (c) 2014 Cem Olcay. All rights reserved. +// Created by Thiha Aung on 3/14/17. +// Copyright © 2017 Imagination. All rights reserved. // import UIKit class ViewController: UIViewController { + var bubble: BubbleControl! override func viewDidLoad() { super.viewDidLoad() setupBubble() } - // MARK: Bubble - - var bubble: BubbleControl! - + func setupBubble () { let win = APPDELEGATE.window! - bubble = BubbleControl (size: CGSizeMake(80, 80)) + bubble = BubbleControl (size: CGSize(width: 80, height: 80)) bubble.image = UIImage (named: "basket.png") bubble.didNavigationBarButtonPressed = { - println("pressed in nav bar") + print("pressed in nav bar") self.bubble!.popFromNavBar() } @@ -36,24 +34,24 @@ class ViewController: UIViewController { self.bubble.contentView!.bottom = win.bottom if (self.bubble.center.x > win.center.x) { self.bubble.contentView!.left = win.right - self.bubble.contentView!.spring({ () -> Void in + self.bubble.contentView!.spring(animations: { () -> Void in self.bubble.contentView!.right = win.right }, completion: nil) } else { self.bubble.contentView!.right = win.left - self.bubble.contentView!.spring({ () -> Void in + self.bubble.contentView!.spring(animations: { () -> Void in self.bubble.contentView!.left = win.left }, completion: nil) } } - let min: CGFloat = 50 + //let min: CGFloat = 50 let max: CGFloat = win.h - 250 - let randH = min + CGFloat(random()%Int(max-min)) + //let randH = min + CGFloat(random()%Int(max-min)) let v = UIView (frame: CGRect (x: 0, y: 0, width: win.w, height: max)) - v.backgroundColor = UIColor.grayColor() + v.backgroundColor = UIColor.gray let label = UILabel (frame: CGRect (x: 10, y: 10, width: v.w, height: 20)) label.text = "test text" @@ -64,15 +62,13 @@ class ViewController: UIViewController { win.addSubview(bubble) } - - // MARK: Animation var animateIcon: Bool = false { didSet { if animateIcon { bubble.didToggle = { on in - if let shapeLayer = self.bubble.imageView?.layer.sublayers?[0] as? CAShapeLayer { + if (self.bubble.imageView?.layer.sublayers?[0] as? CAShapeLayer) != nil { self.animateBubbleIcon(on) } else { @@ -80,7 +76,7 @@ class ViewController: UIViewController { let shapeLayer = CAShapeLayer () shapeLayer.lineWidth = 0.25 - shapeLayer.strokeColor = UIColor.blackColor().CGColor + shapeLayer.strokeColor = UIColor.black.cgColor shapeLayer.fillMode = kCAFillModeForwards self.bubble.imageView?.layer.addSublayer(shapeLayer) @@ -95,19 +91,19 @@ class ViewController: UIViewController { } } - func animateBubbleIcon (on: Bool) { + func animateBubbleIcon (_ on: Bool) { let shapeLayer = self.bubble.imageView!.layer.sublayers![0] as! CAShapeLayer - let from = on ? self.basketBezier().CGPath: self.arrowBezier().CGPath - let to = on ? self.arrowBezier().CGPath: self.basketBezier().CGPath + let from = on ? self.basketBezier().cgPath: self.arrowBezier().cgPath + let to = on ? self.arrowBezier().cgPath: self.basketBezier().cgPath let anim = CABasicAnimation (keyPath: "path") anim.fromValue = from anim.toValue = to anim.duration = 0.5 anim.fillMode = kCAFillModeForwards - anim.removedOnCompletion = false + anim.isRemovedOnCompletion = false - shapeLayer.addAnimation (anim, forKey:"bezier") + shapeLayer.add (anim, forKey:"bezier") } func arrowBezier () -> UIBezierPath { @@ -116,36 +112,36 @@ class ViewController: UIViewController { let color0 = UIColor(red: 0.000, green: 0.000, blue: 0.000, alpha: 1.000) - var bezier2Path = UIBezierPath() - bezier2Path.moveToPoint(CGPointMake(21.22, 2.89)) - bezier2Path.addCurveToPoint(CGPointMake(19.87, 6.72), controlPoint1: CGPointMake(21.22, 6.12), controlPoint2: CGPointMake(20.99, 6.72)) - bezier2Path.addCurveToPoint(CGPointMake(14.54, 7.92), controlPoint1: CGPointMake(19.12, 6.72), controlPoint2: CGPointMake(16.72, 7.24)) - bezier2Path.addCurveToPoint(CGPointMake(0.44, 25.84), controlPoint1: CGPointMake(7.27, 10.09), controlPoint2: CGPointMake(1.64, 17.14)) - bezier2Path.addCurveToPoint(CGPointMake(2.39, 26.97), controlPoint1: CGPointMake(-0.08, 29.74), controlPoint2: CGPointMake(1.12, 30.49)) - bezier2Path.addCurveToPoint(CGPointMake(17.62, 16.09), controlPoint1: CGPointMake(4.34, 21.19), controlPoint2: CGPointMake(10.12, 17.14)) - bezier2Path.addLineToPoint(CGPointMake(21.14, 15.64)) - bezier2Path.addLineToPoint(CGPointMake(21.37, 19.47)) - bezier2Path.addLineToPoint(CGPointMake(21.59, 23.29)) - bezier2Path.addLineToPoint(CGPointMake(29.09, 17.52)) - bezier2Path.addCurveToPoint(CGPointMake(36.59, 11.22), controlPoint1: CGPointMake(33.22, 14.37), controlPoint2: CGPointMake(36.59, 11.52)) - bezier2Path.addCurveToPoint(CGPointMake(22.12, -0.33), controlPoint1: CGPointMake(36.59, 10.69), controlPoint2: CGPointMake(24.89, 1.39)) - bezier2Path.addCurveToPoint(CGPointMake(21.22, 2.89), controlPoint1: CGPointMake(21.44, -0.71), controlPoint2: CGPointMake(21.22, 0.19)) - bezier2Path.closePath() - bezier2Path.moveToPoint(CGPointMake(31.87, 8.82)) - bezier2Path.addCurveToPoint(CGPointMake(34.64, 11.22), controlPoint1: CGPointMake(33.44, 9.94), controlPoint2: CGPointMake(34.72, 10.99)) - bezier2Path.addCurveToPoint(CGPointMake(28.87, 15.87), controlPoint1: CGPointMake(34.64, 11.44), controlPoint2: CGPointMake(32.09, 13.54)) - bezier2Path.addLineToPoint(CGPointMake(23.09, 20.14)) - bezier2Path.addLineToPoint(CGPointMake(22.87, 17.07)) - bezier2Path.addLineToPoint(CGPointMake(22.64, 13.99)) - bezier2Path.addLineToPoint(CGPointMake(18.97, 14.44)) - bezier2Path.addCurveToPoint(CGPointMake(6.22, 19.24), controlPoint1: CGPointMake(13.04, 15.12), controlPoint2: CGPointMake(9.44, 16.54)) - bezier2Path.addCurveToPoint(CGPointMake(5.09, 16.84), controlPoint1: CGPointMake(2.77, 22.24), controlPoint2: CGPointMake(2.39, 21.49)) - bezier2Path.addCurveToPoint(CGPointMake(20.69, 8.22), controlPoint1: CGPointMake(8.09, 11.82), controlPoint2: CGPointMake(14.54, 8.22)) - bezier2Path.addCurveToPoint(CGPointMake(22.72, 5.14), controlPoint1: CGPointMake(22.57, 8.22), controlPoint2: CGPointMake(22.72, 7.99)) - bezier2Path.addLineToPoint(CGPointMake(22.72, 2.07)) - bezier2Path.addLineToPoint(CGPointMake(25.94, 4.47)) - bezier2Path.addCurveToPoint(CGPointMake(31.87, 8.82), controlPoint1: CGPointMake(27.67, 5.74), controlPoint2: CGPointMake(30.37, 7.77)) - bezier2Path.closePath() + let bezier2Path = UIBezierPath() + bezier2Path.move(to: CGPoint(x: 21.22, y: 2.89)) + bezier2Path.addCurve(to: CGPoint(x: 19.87, y: 6.72), controlPoint1: CGPoint(x: 21.22, y: 6.12), controlPoint2: CGPoint(x: 20.99, y: 6.72)) + bezier2Path.addCurve(to: CGPoint(x: 14.54, y: 7.92), controlPoint1: CGPoint(x: 19.12, y: 6.72), controlPoint2: CGPoint(x: 16.72, y: 7.24)) + bezier2Path.addCurve(to: CGPoint(x: 0.44, y: 25.84), controlPoint1: CGPoint(x: 7.27, y: 10.09), controlPoint2: CGPoint(x: 1.64, y: 17.14)) + bezier2Path.addCurve(to: CGPoint(x: 2.39, y: 26.97), controlPoint1: CGPoint(x: -0.08, y: 29.74), controlPoint2: CGPoint(x: 1.12, y: 30.49)) + bezier2Path.addCurve(to: CGPoint(x: 17.62, y: 16.09), controlPoint1: CGPoint(x: 4.34, y: 21.19), controlPoint2: CGPoint(x: 10.12, y: 17.14)) + bezier2Path.addLine(to: CGPoint(x: 21.14, y: 15.64)) + bezier2Path.addLine(to: CGPoint(x: 21.37, y: 19.47)) + bezier2Path.addLine(to: CGPoint(x: 21.59, y: 23.29)) + bezier2Path.addLine(to: CGPoint(x: 29.09, y: 17.52)) + bezier2Path.addCurve(to: CGPoint(x: 36.59, y: 11.22), controlPoint1: CGPoint(x: 33.22, y: 14.37), controlPoint2: CGPoint(x: 36.59, y: 11.52)) + bezier2Path.addCurve(to: CGPoint(x: 22.12, y: -0.33), controlPoint1: CGPoint(x: 36.59, y: 10.69), controlPoint2: CGPoint(x: 24.89, y: 1.39)) + bezier2Path.addCurve(to: CGPoint(x: 21.22, y: 2.89), controlPoint1: CGPoint(x: 21.44, y: -0.71), controlPoint2: CGPoint(x: 21.22, y: 0.19)) + bezier2Path.close() + bezier2Path.move(to: CGPoint(x: 31.87, y: 8.82)) + bezier2Path.addCurve(to: CGPoint(x: 34.64, y: 11.22), controlPoint1: CGPoint(x: 33.44, y: 9.94), controlPoint2: CGPoint(x: 34.72, y: 10.99)) + bezier2Path.addCurve(to: CGPoint(x: 28.87, y: 15.87), controlPoint1: CGPoint(x: 34.64, y: 11.44), controlPoint2: CGPoint(x: 32.09, y: 13.54)) + bezier2Path.addLine(to: CGPoint(x: 23.09, y: 20.14)) + bezier2Path.addLine(to: CGPoint(x: 22.87, y: 17.07)) + bezier2Path.addLine(to: CGPoint(x: 22.64, y: 13.99)) + bezier2Path.addLine(to: CGPoint(x: 18.97, y: 14.44)) + bezier2Path.addCurve(to: CGPoint(x: 6.22, y: 19.24), controlPoint1: CGPoint(x: 13.04, y: 15.12), controlPoint2: CGPoint(x: 9.44, y: 16.54)) + bezier2Path.addCurve(to: CGPoint(x: 5.09, y: 16.84), controlPoint1: CGPoint(x: 2.77, y: 22.24), controlPoint2: CGPoint(x: 2.39, y: 21.49)) + bezier2Path.addCurve(to: CGPoint(x: 20.69, y: 8.22), controlPoint1: CGPoint(x: 8.09, y: 11.82), controlPoint2: CGPoint(x: 14.54, y: 8.22)) + bezier2Path.addCurve(to: CGPoint(x: 22.72, y: 5.14), controlPoint1: CGPoint(x: 22.57, y: 8.22), controlPoint2: CGPoint(x: 22.72, y: 7.99)) + bezier2Path.addLine(to: CGPoint(x: 22.72, y: 2.07)) + bezier2Path.addLine(to: CGPoint(x: 25.94, y: 4.47)) + bezier2Path.addCurve(to: CGPoint(x: 31.87, y: 8.82), controlPoint1: CGPoint(x: 27.67, y: 5.74), controlPoint2: CGPoint(x: 30.37, y: 7.77)) + bezier2Path.close() bezier2Path.miterLimit = 4; color0.setFill() @@ -159,65 +155,65 @@ class ViewController: UIViewController { let color0 = UIColor(red: 0.000, green: 0.000, blue: 0.000, alpha: 1.000) - var bezier2Path = UIBezierPath() - bezier2Path.moveToPoint(CGPointMake(0.86, 0.36)) - bezier2Path.addCurveToPoint(CGPointMake(3.41, 6.21), controlPoint1: CGPointMake(-0.27, 1.41), controlPoint2: CGPointMake(0.48, 2.98)) - bezier2Path.addLineToPoint(CGPointMake(6.41, 9.51)) - bezier2Path.addLineToPoint(CGPointMake(3.18, 9.73)) - bezier2Path.addCurveToPoint(CGPointMake(-0.27, 12.96), controlPoint1: CGPointMake(0.03, 9.96), controlPoint2: CGPointMake(-0.04, 10.03)) - bezier2Path.addCurveToPoint(CGPointMake(0.48, 16.71), controlPoint1: CGPointMake(-0.42, 14.83), controlPoint2: CGPointMake(-0.12, 16.18)) - bezier2Path.addCurveToPoint(CGPointMake(3.26, 23.46), controlPoint1: CGPointMake(1.08, 17.08), controlPoint2: CGPointMake(2.28, 20.16)) - bezier2Path.addCurveToPoint(CGPointMake(18.33, 32.08), controlPoint1: CGPointMake(6.03, 32.91), controlPoint2: CGPointMake(4.61, 32.08)) - bezier2Path.addCurveToPoint(CGPointMake(33.41, 23.46), controlPoint1: CGPointMake(32.06, 32.08), controlPoint2: CGPointMake(30.63, 32.91)) - bezier2Path.addCurveToPoint(CGPointMake(36.18, 16.71), controlPoint1: CGPointMake(34.38, 20.16), controlPoint2: CGPointMake(35.58, 17.08)) - bezier2Path.addCurveToPoint(CGPointMake(36.93, 12.96), controlPoint1: CGPointMake(36.78, 16.18), controlPoint2: CGPointMake(37.08, 14.83)) - bezier2Path.addCurveToPoint(CGPointMake(33.48, 9.73), controlPoint1: CGPointMake(36.71, 10.03), controlPoint2: CGPointMake(36.63, 9.96)) - bezier2Path.addLineToPoint(CGPointMake(30.26, 9.51)) - bezier2Path.addLineToPoint(CGPointMake(33.33, 6.13)) - bezier2Path.addCurveToPoint(CGPointMake(36.18, 1.48), controlPoint1: CGPointMake(35.06, 4.26), controlPoint2: CGPointMake(36.33, 2.16)) - bezier2Path.addCurveToPoint(CGPointMake(28.23, 4.63), controlPoint1: CGPointMake(35.66, -1.22), controlPoint2: CGPointMake(33.26, -0.24)) - bezier2Path.addLineToPoint(CGPointMake(23.06, 9.58)) - bezier2Path.addLineToPoint(CGPointMake(18.33, 9.58)) - bezier2Path.addLineToPoint(CGPointMake(13.61, 9.58)) - bezier2Path.addLineToPoint(CGPointMake(8.51, 4.71)) - bezier2Path.addCurveToPoint(CGPointMake(0.86, 0.36), controlPoint1: CGPointMake(3.78, 0.13), controlPoint2: CGPointMake(2.06, -0.84)) - bezier2Path.closePath() - bezier2Path.moveToPoint(CGPointMake(10.08, 12.66)) - bezier2Path.addCurveToPoint(CGPointMake(14.58, 12.21), controlPoint1: CGPointMake(12.33, 14.38), controlPoint2: CGPointMake(14.58, 14.16)) - bezier2Path.addCurveToPoint(CGPointMake(18.33, 11.08), controlPoint1: CGPointMake(14.58, 11.38), controlPoint2: CGPointMake(15.48, 11.08)) - bezier2Path.addCurveToPoint(CGPointMake(22.08, 12.21), controlPoint1: CGPointMake(21.18, 11.08), controlPoint2: CGPointMake(22.08, 11.38)) - bezier2Path.addCurveToPoint(CGPointMake(26.58, 12.66), controlPoint1: CGPointMake(22.08, 14.16), controlPoint2: CGPointMake(24.33, 14.38)) - bezier2Path.addCurveToPoint(CGPointMake(32.21, 11.08), controlPoint1: CGPointMake(28.08, 11.61), controlPoint2: CGPointMake(29.88, 11.08)) - bezier2Path.addCurveToPoint(CGPointMake(35.58, 13.33), controlPoint1: CGPointMake(35.43, 11.08), controlPoint2: CGPointMake(35.58, 11.16)) - bezier2Path.addLineToPoint(CGPointMake(35.58, 15.58)) - bezier2Path.addLineToPoint(CGPointMake(18.33, 15.58)) - bezier2Path.addLineToPoint(CGPointMake(1.08, 15.58)) - bezier2Path.addLineToPoint(CGPointMake(1.08, 13.33)) - bezier2Path.addCurveToPoint(CGPointMake(4.46, 11.08), controlPoint1: CGPointMake(1.08, 11.16), controlPoint2: CGPointMake(1.23, 11.08)) - bezier2Path.addCurveToPoint(CGPointMake(10.08, 12.66), controlPoint1: CGPointMake(6.78, 11.08), controlPoint2: CGPointMake(8.58, 11.61)) - bezier2Path.closePath() - bezier2Path.moveToPoint(CGPointMake(11.21, 22.86)) - bezier2Path.addCurveToPoint(CGPointMake(12.71, 28.71), controlPoint1: CGPointMake(11.21, 28.18), controlPoint2: CGPointMake(11.36, 28.71)) - bezier2Path.addCurveToPoint(CGPointMake(14.43, 22.86), controlPoint1: CGPointMake(14.06, 28.71), controlPoint2: CGPointMake(14.21, 28.11)) - bezier2Path.addCurveToPoint(CGPointMake(15.56, 17.08), controlPoint1: CGPointMake(14.58, 18.96), controlPoint2: CGPointMake(14.96, 17.08)) - bezier2Path.addCurveToPoint(CGPointMake(16.23, 21.21), controlPoint1: CGPointMake(16.16, 17.08), controlPoint2: CGPointMake(16.38, 18.36)) - bezier2Path.addCurveToPoint(CGPointMake(18.56, 28.93), controlPoint1: CGPointMake(15.86, 27.13), controlPoint2: CGPointMake(16.46, 29.23)) - bezier2Path.addCurveToPoint(CGPointMake(20.21, 22.86), controlPoint1: CGPointMake(20.13, 28.71), controlPoint2: CGPointMake(20.21, 28.33)) - bezier2Path.addCurveToPoint(CGPointMake(21.11, 17.08), controlPoint1: CGPointMake(20.21, 18.88), controlPoint2: CGPointMake(20.51, 17.08)) - bezier2Path.addCurveToPoint(CGPointMake(22.23, 22.86), controlPoint1: CGPointMake(21.71, 17.08), controlPoint2: CGPointMake(22.08, 18.96)) - bezier2Path.addCurveToPoint(CGPointMake(23.96, 28.71), controlPoint1: CGPointMake(22.46, 28.11), controlPoint2: CGPointMake(22.61, 28.71)) - bezier2Path.addCurveToPoint(CGPointMake(25.46, 22.86), controlPoint1: CGPointMake(25.31, 28.71), controlPoint2: CGPointMake(25.46, 28.18)) - bezier2Path.addLineToPoint(CGPointMake(25.46, 17.08)) - bezier2Path.addLineToPoint(CGPointMake(29.43, 17.08)) - bezier2Path.addCurveToPoint(CGPointMake(31.53, 24.58), controlPoint1: CGPointMake(33.93, 17.08), controlPoint2: CGPointMake(33.86, 16.78)) - bezier2Path.addLineToPoint(CGPointMake(29.88, 30.21)) - bezier2Path.addLineToPoint(CGPointMake(18.33, 30.21)) - bezier2Path.addLineToPoint(CGPointMake(6.78, 30.21)) - bezier2Path.addLineToPoint(CGPointMake(5.13, 24.58)) - bezier2Path.addCurveToPoint(CGPointMake(7.31, 17.08), controlPoint1: CGPointMake(2.81, 16.78), controlPoint2: CGPointMake(2.73, 17.08)) - bezier2Path.addLineToPoint(CGPointMake(11.21, 17.08)) - bezier2Path.addLineToPoint(CGPointMake(11.21, 22.86)) - bezier2Path.closePath() + let bezier2Path = UIBezierPath() + bezier2Path.move(to: CGPoint(x: 0.86, y: 0.36)) + bezier2Path.addCurve(to: CGPoint(x: 3.41, y: 6.21), controlPoint1: CGPoint(x: -0.27, y: 1.41), controlPoint2: CGPoint(x: 0.48, y: 2.98)) + bezier2Path.addLine(to: CGPoint(x: 6.41, y: 9.51)) + bezier2Path.addLine(to: CGPoint(x: 3.18, y: 9.73)) + bezier2Path.addCurve(to: CGPoint(x: -0.27, y: 12.96), controlPoint1: CGPoint(x: 0.03, y: 9.96), controlPoint2: CGPoint(x: -0.04, y: 10.03)) + bezier2Path.addCurve(to: CGPoint(x: 0.48, y: 16.71), controlPoint1: CGPoint(x: -0.42, y: 14.83), controlPoint2: CGPoint(x: -0.12, y: 16.18)) + bezier2Path.addCurve(to: CGPoint(x: 3.26, y: 23.46), controlPoint1: CGPoint(x: 1.08, y: 17.08), controlPoint2: CGPoint(x: 2.28, y: 20.16)) + bezier2Path.addCurve(to: CGPoint(x: 18.33, y: 32.08), controlPoint1: CGPoint(x: 6.03, y: 32.91), controlPoint2: CGPoint(x: 4.61, y: 32.08)) + bezier2Path.addCurve(to: CGPoint(x: 33.41, y: 23.46), controlPoint1: CGPoint(x: 32.06, y: 32.08), controlPoint2: CGPoint(x: 30.63, y: 32.91)) + bezier2Path.addCurve(to: CGPoint(x: 36.18, y: 16.71), controlPoint1: CGPoint(x: 34.38, y: 20.16), controlPoint2: CGPoint(x: 35.58, y: 17.08)) + bezier2Path.addCurve(to: CGPoint(x: 36.93, y: 12.96), controlPoint1: CGPoint(x: 36.78, y: 16.18), controlPoint2: CGPoint(x: 37.08, y: 14.83)) + bezier2Path.addCurve(to: CGPoint(x: 33.48, y: 9.73), controlPoint1: CGPoint(x: 36.71, y: 10.03), controlPoint2: CGPoint(x: 36.63, y: 9.96)) + bezier2Path.addLine(to: CGPoint(x: 30.26, y: 9.51)) + bezier2Path.addLine(to: CGPoint(x: 33.33, y: 6.13)) + bezier2Path.addCurve(to: CGPoint(x: 36.18, y: 1.48), controlPoint1: CGPoint(x: 35.06, y: 4.26), controlPoint2: CGPoint(x: 36.33, y: 2.16)) + bezier2Path.addCurve(to: CGPoint(x: 28.23, y: 4.63), controlPoint1: CGPoint(x: 35.66, y: -1.22), controlPoint2: CGPoint(x: 33.26, y: -0.24)) + bezier2Path.addLine(to: CGPoint(x: 23.06, y: 9.58)) + bezier2Path.addLine(to: CGPoint(x: 18.33, y: 9.58)) + bezier2Path.addLine(to: CGPoint(x: 13.61, y: 9.58)) + bezier2Path.addLine(to: CGPoint(x: 8.51, y: 4.71)) + bezier2Path.addCurve(to: CGPoint(x: 0.86, y: 0.36), controlPoint1: CGPoint(x: 3.78, y: 0.13), controlPoint2: CGPoint(x: 2.06, y: -0.84)) + bezier2Path.close() + bezier2Path.move(to: CGPoint(x: 10.08, y: 12.66)) + bezier2Path.addCurve(to: CGPoint(x: 14.58, y: 12.21), controlPoint1: CGPoint(x: 12.33, y: 14.38), controlPoint2: CGPoint(x: 14.58, y: 14.16)) + bezier2Path.addCurve(to: CGPoint(x: 18.33, y: 11.08), controlPoint1: CGPoint(x: 14.58, y: 11.38), controlPoint2: CGPoint(x: 15.48, y: 11.08)) + bezier2Path.addCurve(to: CGPoint(x: 22.08, y: 12.21), controlPoint1: CGPoint(x: 21.18, y: 11.08), controlPoint2: CGPoint(x: 22.08, y: 11.38)) + bezier2Path.addCurve(to: CGPoint(x: 26.58, y: 12.66), controlPoint1: CGPoint(x: 22.08, y: 14.16), controlPoint2: CGPoint(x: 24.33, y: 14.38)) + bezier2Path.addCurve(to: CGPoint(x: 32.21, y: 11.08), controlPoint1: CGPoint(x: 28.08, y: 11.61), controlPoint2: CGPoint(x: 29.88, y: 11.08)) + bezier2Path.addCurve(to: CGPoint(x: 35.58, y: 13.33), controlPoint1: CGPoint(x: 35.43, y: 11.08), controlPoint2: CGPoint(x: 35.58, y: 11.16)) + bezier2Path.addLine(to: CGPoint(x: 35.58, y: 15.58)) + bezier2Path.addLine(to: CGPoint(x: 18.33, y: 15.58)) + bezier2Path.addLine(to: CGPoint(x: 1.08, y: 15.58)) + bezier2Path.addLine(to: CGPoint(x: 1.08, y: 13.33)) + bezier2Path.addCurve(to: CGPoint(x: 4.46, y: 11.08), controlPoint1: CGPoint(x: 1.08, y: 11.16), controlPoint2: CGPoint(x: 1.23, y: 11.08)) + bezier2Path.addCurve(to: CGPoint(x: 10.08, y: 12.66), controlPoint1: CGPoint(x: 6.78, y: 11.08), controlPoint2: CGPoint(x: 8.58, y: 11.61)) + bezier2Path.close() + bezier2Path.move(to: CGPoint(x: 11.21, y: 22.86)) + bezier2Path.addCurve(to: CGPoint(x: 12.71, y: 28.71), controlPoint1: CGPoint(x: 11.21, y: 28.18), controlPoint2: CGPoint(x: 11.36, y: 28.71)) + bezier2Path.addCurve(to: CGPoint(x: 14.43, y: 22.86), controlPoint1: CGPoint(x: 14.06, y: 28.71), controlPoint2: CGPoint(x: 14.21, y: 28.11)) + bezier2Path.addCurve(to: CGPoint(x: 15.56, y: 17.08), controlPoint1: CGPoint(x: 14.58, y: 18.96), controlPoint2: CGPoint(x: 14.96, y: 17.08)) + bezier2Path.addCurve(to: CGPoint(x: 16.23, y: 21.21), controlPoint1: CGPoint(x: 16.16, y: 17.08), controlPoint2: CGPoint(x: 16.38, y: 18.36)) + bezier2Path.addCurve(to: CGPoint(x: 18.56, y: 28.93), controlPoint1: CGPoint(x: 15.86, y: 27.13), controlPoint2: CGPoint(x: 16.46, y: 29.23)) + bezier2Path.addCurve(to: CGPoint(x: 20.21, y: 22.86), controlPoint1: CGPoint(x: 20.13, y: 28.71), controlPoint2: CGPoint(x: 20.21, y: 28.33)) + bezier2Path.addCurve(to: CGPoint(x: 21.11, y: 17.08), controlPoint1: CGPoint(x: 20.21, y: 18.88), controlPoint2: CGPoint(x: 20.51, y: 17.08)) + bezier2Path.addCurve(to: CGPoint(x: 22.23, y: 22.86), controlPoint1: CGPoint(x: 21.71, y: 17.08), controlPoint2: CGPoint(x: 22.08, y: 18.96)) + bezier2Path.addCurve(to: CGPoint(x: 23.96, y: 28.71), controlPoint1: CGPoint(x: 22.46, y: 28.11), controlPoint2: CGPoint(x: 22.61, y: 28.71)) + bezier2Path.addCurve(to: CGPoint(x: 25.46, y: 22.86), controlPoint1: CGPoint(x: 25.31, y: 28.71), controlPoint2: CGPoint(x: 25.46, y: 28.18)) + bezier2Path.addLine(to: CGPoint(x: 25.46, y: 17.08)) + bezier2Path.addLine(to: CGPoint(x: 29.43, y: 17.08)) + bezier2Path.addCurve(to: CGPoint(x: 31.53, y: 24.58), controlPoint1: CGPoint(x: 33.93, y: 17.08), controlPoint2: CGPoint(x: 33.86, y: 16.78)) + bezier2Path.addLine(to: CGPoint(x: 29.88, y: 30.21)) + bezier2Path.addLine(to: CGPoint(x: 18.33, y: 30.21)) + bezier2Path.addLine(to: CGPoint(x: 6.78, y: 30.21)) + bezier2Path.addLine(to: CGPoint(x: 5.13, y: 24.58)) + bezier2Path.addCurve(to: CGPoint(x: 7.31, y: 17.08), controlPoint1: CGPoint(x: 2.81, y: 16.78), controlPoint2: CGPoint(x: 2.73, y: 17.08)) + bezier2Path.addLine(to: CGPoint(x: 11.21, y: 17.08)) + bezier2Path.addLine(to: CGPoint(x: 11.21, y: 22.86)) + bezier2Path.close() bezier2Path.miterLimit = 4; color0.setFill() @@ -225,30 +221,26 @@ class ViewController: UIViewController { return bezier2Path } - - // MARK: IBActions - @IBAction func postionValueChanged(sender: UISwitch) { - bubble.movesBottom = sender.on + @IBAction func postionValueChanged(_ sender: UISwitch) { + bubble.movesBottom = sender.isOn } - @IBAction func animateIconValueChanged(sender: UISwitch) { - animateIcon = sender.on + @IBAction func animateIconValueChanged(_ sender: UISwitch) { + animateIcon = sender.isOn } - @IBAction func snapInsideChanged(sender: UISwitch) { - bubble.snapsInside = sender.on + @IBAction func snapInsideChanged(_ sender: UISwitch) { + bubble.snapsInside = sender.isOn } - - - @IBAction func addPressed(sender: AnyObject) { - bubble.badgeCount++ + @IBAction func addPressed(_ sender: AnyObject) { + bubble.badgeCount += 1 } - @IBAction func removePressed(sender: AnyObject) { - bubble.badgeCount-- + @IBAction func removePressed(_ sender: AnyObject) { + bubble.badgeCount -= 1 } } diff --git a/BubbleControl-SwiftTests/Info.plist b/BubbleControl-SwiftTests/Info.plist index 9ffbad5..ba72822 100644 --- a/BubbleControl-SwiftTests/Info.plist +++ b/BubbleControl-SwiftTests/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.questa.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName