Skip to content

Commit

Permalink
Merge pull request #238 from ylin0x81/fix-memory-leak
Browse files Browse the repository at this point in the history
Fixed a memory leak in YPImagePicker
  • Loading branch information
s4cha authored Oct 9, 2018
2 parents 5e6a28e + 72e250c commit 8f536a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Source/YPImagePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
import AVFoundation
import Photos

public protocol YPImagePickerDelegate {
public protocol YPImagePickerDelegate: AnyObject {
func noPhotos()
}

Expand All @@ -27,7 +27,7 @@ public class YPImagePicker: UINavigationController {
public func didFinishPicking(completion: @escaping (_ items: [YPMediaItem], _ cancelled: Bool) -> Void) {
_didFinishPicking = completion
}
public var imagePickerDelegate: YPImagePickerDelegate?
public weak var imagePickerDelegate: YPImagePickerDelegate?

public override var preferredStatusBarStyle: UIStatusBarStyle {
return YPImagePickerConfiguration.shared.preferredStatusBarStyle
Expand Down
4 changes: 2 additions & 2 deletions Source/YPPickerVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import Stevia
import Photos

protocol ImagePickerDelegate {
protocol ImagePickerDelegate: AnyObject {
func noPhotos()
}

Expand All @@ -19,7 +19,7 @@ public class YPPickerVC: YPBottomPager, YPBottomPagerDelegate {
let albumsManager = YPAlbumsManager()
var shouldHideStatusBar = false
var initialStatusBarHidden = false
var imagePickerDelegate: ImagePickerDelegate?
weak var imagePickerDelegate: ImagePickerDelegate?

override public var prefersStatusBarHidden: Bool {
return (shouldHideStatusBar || initialStatusBarHidden) && YPConfig.hidesStatusBar
Expand Down

0 comments on commit 8f536a3

Please sign in to comment.