In an app I\'m working on, there is a requirement to periodically poll for device\'s data like acceleration, gyro and motion. I wrote the following class to handle all the r
You directly access self in blocks, that may cause retain cycle. Try to use weak self like:
self
motionDetector?.motionTypeChangedBlock = { [weak self] motionType in if motionType == MotionTypeNotMoving { self?.isMoving = false } else { self?.isMoving = true } }
So does others blocks.