Skip to content

Commit

Permalink
[BUG FIX] Simultaneous access to memory due to KVO
Browse files Browse the repository at this point in the history
This commit fix issue dekatotoro#34, an issue that was previously fixed by PR #73
but reappeared because of Swift-4's improved runtime checks, pointed out
by Michael Brown in his blog.

http://michael-brown.net/2017/swift-and-kvo-context-variables/

This buf was already fixed by PR 72, however
  • Loading branch information
MaG21 committed Nov 24, 2017
1 parent 24af1e5 commit 2d1387e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/PullToRefreshView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
//
import UIKit

/*
Fix: Simultaneous access to memory due to KVO
For more information regarding this global variable follow the followinf links:
1. https://developer.apple.com/swift/blog/?id=6
2. http://michael-brown.net/2017/swift-and-kvo-context-variables/
*/
private var kvoContext = "PullToRefreshKVOContext"

open class PullToRefreshView: UIView {
enum PullToRefreshState {
case pulling
Expand All @@ -19,7 +28,6 @@ open class PullToRefreshView: UIView {
// MARK: Variables
let contentOffsetKeyPath = "contentOffset"
let contentSizeKeyPath = "contentSize"
var kvoContext = "PullToRefreshKVOContext"

fileprivate var options: PullToRefreshOption
fileprivate var backgroundView: UIView
Expand Down

0 comments on commit 2d1387e

Please sign in to comment.