This version is compatible, theoretically, with any version from Swift 3 to 5 (solve #63 and #72)
This implementation also removed the strong reference cycles (which are causing memory leaks).
I'm aware of this [issue](https://github.com/LiulietLee/Pick-Color/issues/2) a long time ago, but had no idea why just declaring superLayer as `weak` causes unexpected crashes. Thanks to @theMeatloaf for his solutions in Swift 2, we only need to manually remove the observers by calling `recycle` method of MKLayer and MKRefreshControl if a class owns such properties directly. I can't figure out a way for us to automatically remove the observers, especially when the time `deinit` of MKLayer gets called, superLayer is already nil. Therefore, if you have a better solution, please definitely help.
And yes, in addition to MKLayer and all other classes that has a property of type MKLayer, MKRefreshControl has [strong reference loop](https://github.com/nghialv/MaterialKit/blob/master/Source/MKRefreshControl.swift#L14) and [observer](https://github.com/nghialv/MaterialKit/blob/master/Source/MKRefreshControl.swift#L55) not removed, and MKSwitch has a [strong reference loop](https://github.com/nghialv/MaterialKit/blob/master/Source/MKSwitch.swift#L179), too.
Since the repo is no longer maintained, use this in your Podfile instead:
or in your Package.swift:
This version is compatible, theoretically, with any version from Swift 3 to 5 (solve #63 and #72)
This implementation also removed the strong reference cycles (which are causing memory leaks).
I'm aware of this [issue](https://github.com/LiulietLee/Pick-Color/issues/2) a long time ago, but had no idea why just declaring superLayer as `weak` causes unexpected crashes. Thanks to @theMeatloaf for his solutions in Swift 2, we only need to manually remove the observers by calling `recycle` method of MKLayer and MKRefreshControl if a class owns such properties directly. I can't figure out a way for us to automatically remove the observers, especially when the time `deinit` of MKLayer gets called, superLayer is already nil. Therefore, if you have a better solution, please definitely help. And yes, in addition to MKLayer and all other classes that has a property of type MKLayer, MKRefreshControl has [strong reference loop](https://github.com/nghialv/MaterialKit/blob/master/Source/MKRefreshControl.swift#L14) and [observer](https://github.com/nghialv/MaterialKit/blob/master/Source/MKRefreshControl.swift#L55) not removed, and MKSwitch has a [strong reference loop](https://github.com/nghialv/MaterialKit/blob/master/Source/MKSwitch.swift#L179), too.