Skip to content

Commit

Permalink
Merge branch 'release/1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Haozhe XU committed Mar 9, 2018
2 parents 5885b87 + b562600 commit 5b69dac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion AssistiveControl.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |s|

s.name = "AssistiveControl"
s.version = "1.3"
s.version = "1.4"
s.summary = "UIControl subclass which mimics the behaviour of iOS Assistive Touch on screen button, fully customisable and extensible."

s.description = <<-DESC
Expand Down
30 changes: 15 additions & 15 deletions AssistiveControl/AssistiveControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public protocol AssistiveControlDelegate: class {
}

public protocol AssistiveControlViewProvider: class {
var view: UIView { get }
var assistiveView: UIView { get }
}

/**
Expand Down Expand Up @@ -72,14 +72,14 @@ public class AssistiveControl: UIControl {
guard let newValue = newValue else {
return nil
}
return ViewProvider(view: newValue)
return ViewProvider(newValue)
}()
}
get {
guard let collapsedViewProvider = collapsedViewProvider else {
return nil
}
return collapsedViewProvider.view
return collapsedViewProvider.assistiveView
}
}

Expand All @@ -89,23 +89,23 @@ public class AssistiveControl: UIControl {
guard let newValue = newValue else {
return nil
}
return ViewProvider(view: newValue)
return ViewProvider(newValue)
}()
}
get {
guard let expandedViewProvider = expandedViewProvider else {
return nil
}
return expandedViewProvider.view
return expandedViewProvider.assistiveView
}
}

public var collapsedViewProvider: AssistiveControlViewProvider? {
willSet {
if let newValue = newValue {
collapsedViewProvider?.view.removeFromSuperview()
newValue.view.isUserInteractionEnabled = false
collapsedViewPreviousLocation = newValue.view.frame.origin
collapsedViewProvider?.assistiveView.removeFromSuperview()
newValue.assistiveView.isUserInteractionEnabled = false
collapsedViewPreviousLocation = newValue.assistiveView.frame.origin
}
}
didSet {
Expand All @@ -117,7 +117,7 @@ public class AssistiveControl: UIControl {

public var expandedViewProvider: AssistiveControlViewProvider? {
willSet {
expandedViewProvider?.view.removeFromSuperview()
expandedViewProvider?.assistiveView.removeFromSuperview()
}
didSet {
if assistiveControlState == .expanded {
Expand Down Expand Up @@ -154,7 +154,7 @@ public class AssistiveControl: UIControl {
return
}

expandedViewProvider?.view.removeFromSuperview()
expandedViewProvider?.assistiveView.removeFromSuperview()

var endFrame = collapsedView.frame
endFrame.origin = collapsedViewPreviousLocation
Expand All @@ -169,7 +169,7 @@ public class AssistiveControl: UIControl {
}

private func showExpandedView() {
guard let container = self.superview, let expandedView = self.expandedViewProvider?.view else {
guard let container = self.superview, let expandedView = self.expandedViewProvider?.assistiveView else {
return
}

Expand Down Expand Up @@ -265,10 +265,10 @@ extension AssistiveControl {

private class ViewProvider: AssistiveControlViewProvider {

let view: UIView
let assistiveView: UIView

init(view: UIView) {
self.view = view
init(_ view: UIView) {
self.assistiveView = view
}
}

Expand Down Expand Up @@ -311,7 +311,7 @@ extension AssistiveControl {
delegate?.assistiveControlDidExpand(self)
}
} else if let touchLocation = touch?.location(in: self) {
if expandedViewProvider?.view.frame.contains(touchLocation) ?? false == false {
if expandedViewProvider?.assistiveView.frame.contains(touchLocation) ?? false == false {
delegate?.assistiveControlWillCollapse(self)
showCollapsedView()
delegate?.assistiveControlDidCollapse(self)
Expand Down
2 changes: 1 addition & 1 deletion AssistiveControl/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.3</string>
<string>1.4</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down

0 comments on commit 5b69dac

Please sign in to comment.