diff --git a/BubbleControl-Swift.xcodeproj/project.xcworkspace/xcshareddata/BubbleControl-Swift.xccheckout b/BubbleControl-Swift.xcodeproj/project.xcworkspace/xcshareddata/BubbleControl-Swift.xccheckout
new file mode 100644
index 0000000..1b6d696
--- /dev/null
+++ b/BubbleControl-Swift.xcodeproj/project.xcworkspace/xcshareddata/BubbleControl-Swift.xccheckout
@@ -0,0 +1,41 @@
+
+
+
+
+ IDESourceControlProjectFavoriteDictionaryKey
+
+ IDESourceControlProjectIdentifier
+ 6774D07C-128B-4F7B-B21C-D644FC78E932
+ IDESourceControlProjectName
+ BubbleControl-Swift
+ IDESourceControlProjectOriginsDictionary
+
+ AC1D7CE64D2EF7E33ADE8B45A6E7F6CF2516B52F
+ https://github.com/cemolcay/BubbleControl-Swift.git
+
+ IDESourceControlProjectPath
+ BubbleControl-Swift.xcodeproj
+ IDESourceControlProjectRelativeInstallPathDictionary
+
+ AC1D7CE64D2EF7E33ADE8B45A6E7F6CF2516B52F
+ ../..
+
+ IDESourceControlProjectURL
+ https://github.com/cemolcay/BubbleControl-Swift.git
+ IDESourceControlProjectVersion
+ 111
+ IDESourceControlProjectWCCIdentifier
+ AC1D7CE64D2EF7E33ADE8B45A6E7F6CF2516B52F
+ IDESourceControlProjectWCConfigurations
+
+
+ IDESourceControlRepositoryExtensionIdentifierKey
+ public.vcs.git
+ IDESourceControlWCCIdentifierKey
+ AC1D7CE64D2EF7E33ADE8B45A6E7F6CF2516B52F
+ IDESourceControlWCCName
+ BubbleControl-Swift
+
+
+
+
diff --git a/BubbleControl-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/BubbleControl-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
new file mode 100644
index 0000000..fe2b454
--- /dev/null
+++ b/BubbleControl-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -0,0 +1,5 @@
+
+
+
diff --git a/BubbleControl-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcschemes/BubbleControl-Swift.xcscheme b/BubbleControl-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcschemes/BubbleControl-Swift.xcscheme
new file mode 100644
index 0000000..0b5c576
--- /dev/null
+++ b/BubbleControl-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcschemes/BubbleControl-Swift.xcscheme
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BubbleControl-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcschemes/xcschememanagement.plist b/BubbleControl-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..53212bf
--- /dev/null
+++ b/BubbleControl-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,27 @@
+
+
+
+
+ SchemeUserState
+
+ BubbleControl-Swift.xcscheme
+
+ orderHint
+ 0
+
+
+ SuppressBuildableAutocreation
+
+ B27A54351A39953B00F18798
+
+ primary
+
+
+ B27A544A1A39953B00F18798
+
+ primary
+
+
+
+
+
diff --git a/BubbleControl-Swift/BubbleControl.swift b/BubbleControl-Swift/BubbleControl.swift
index 217d8c4..810a5bc 100644
--- a/BubbleControl-Swift/BubbleControl.swift
+++ b/BubbleControl-Swift/BubbleControl.swift
@@ -648,20 +648,25 @@ class BubbleControl: UIControl {
func openContentView () {
if let v = contentView {
- APPDELEGATE.window!.addSubview(v)
+ let win = APPDELEGATE.window!
+ win.addSubview(v)
+ win.bringSubviewToFront(self)
snapOffset = snapOffsetMin
snap()
positionBeforeToggle = frame.origin
if let anim = setOpenAnimation {
- anim (contentView: v, backgroundView: APPDELEGATE.window?.subviews[0] as? UIView)
+ anim (contentView: v, backgroundView: win.subviews[0] as? UIView)
} else {
- v.bottom = APPDELEGATE.window!.bottom
+ v.bottom = win.bottom
}
- moveY(v.top - h - snapOffset)
- APPDELEGATE.window?.bringSubviewToFront(self)
+ if movesBottom {
+ movePoint(CGPoint (x: win.center.x - w/2, y: win.bottom - h - snapOffset))
+ } else {
+ moveY(v.top - h - snapOffset)
+ }
}
}
diff --git a/BubbleControl-Swift/ViewController.swift b/BubbleControl-Swift/ViewController.swift
index d2f81a3..a9722c6 100644
--- a/BubbleControl-Swift/ViewController.swift
+++ b/BubbleControl-Swift/ViewController.swift
@@ -32,22 +32,21 @@ class ViewController: UIViewController {
self.bubble!.popFromNavBar()
}
-
bubble.setOpenAnimation = { content, background in
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!.right = win.right
- }, completion: nil)
+ }, completion: nil)
} else {
self.bubble.contentView!.right = win.left
self.bubble.contentView!.spring({ () -> Void in
self.bubble.contentView!.left = win.left
- }, completion: nil)
+ }, completion: nil)
}
}
-
+
let min: CGFloat = 50
let max: CGFloat = win.h - 250
diff --git a/demo.gif b/demo.gif
new file mode 100644
index 0000000..e12fbad
Binary files /dev/null and b/demo.gif differ