Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflicts with xcode x #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Source/PullToRefreshView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ open class PullToRefreshView: UIView {
// MARK: Variables
let contentOffsetKeyPath = "contentOffset"
let contentSizeKeyPath = "contentSize"
var kvoContext = "PullToRefreshKVOContext"
private static var kvoContext = "PullToRefreshKVOContext"

fileprivate var options: PullToRefreshOption
fileprivate var backgroundView: UIView
Expand Down Expand Up @@ -120,17 +120,17 @@ open class PullToRefreshView: UIView {
guard let scrollView = superView as? UIScrollView else {
return
}
scrollView.addObserver(self, forKeyPath: contentOffsetKeyPath, options: .initial, context: &kvoContext)
scrollView.addObserver(self, forKeyPath: contentOffsetKeyPath, options: .initial, context: &PullToRefreshView.kvoContext)
if !pull {
scrollView.addObserver(self, forKeyPath: contentSizeKeyPath, options: .initial, context: &kvoContext)
scrollView.addObserver(self, forKeyPath: contentSizeKeyPath, options: .initial, context: &PullToRefreshView.kvoContext)
}
}

fileprivate func removeRegister() {
if let scrollView = superview as? UIScrollView {
scrollView.removeObserver(self, forKeyPath: contentOffsetKeyPath, context: &kvoContext)
scrollView.removeObserver(self, forKeyPath: contentOffsetKeyPath, context: &PullToRefreshView.kvoContext)
if !pull {
scrollView.removeObserver(self, forKeyPath: contentSizeKeyPath, context: &kvoContext)
scrollView.removeObserver(self, forKeyPath: contentSizeKeyPath, context: &PullToRefreshView.kvoContext)
}
}
}
Expand All @@ -150,7 +150,7 @@ open class PullToRefreshView: UIView {
return
}

if !(context == &kvoContext && keyPath == contentOffsetKeyPath) {
if !(context == &PullToRefreshView.kvoContext && keyPath == contentOffsetKeyPath) {
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
return
}
Expand Down Expand Up @@ -237,7 +237,7 @@ open class PullToRefreshView: UIView {
self.state = .stop
}
}
self.refreshCompletion?()
self.refreshCompletion?(())
})
}

Expand Down