Skip to content

Commit

Permalink
Merge pull request #23 from steamclock/jc/22-fix-retain-cycle
Browse files Browse the repository at this point in the history
[22] Fix retain cycle
  • Loading branch information
Jeremy Chiang authored May 13, 2020
2 parents 4047599 + 63268fd commit b067a19
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 32 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.3.1] - 2020-05-12
- Fix view controller retain cycle

## [1.3.0] - 2020-03-18
- Update for Swift 5
- Add SPM support
Expand Down
21 changes: 11 additions & 10 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Sources/Switchcraft/Switchcraft.swift
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,11 @@ public class Switchcraft {
* - returns: The new `UITapGestureRecognizer`.
*/
private func makeDefaultGestureRecognizer(forVC viewController: UIViewController) -> UITapGestureRecognizer {
showSwitcher = { self.display(from: viewController) }
showSwitcher = { [weak viewController] in
if let viewController = viewController {
self.display(from: viewController)
}
}

let defaultGesture = UITapGestureRecognizer(target: self, action: #selector(tapHandler(_:)))

Expand Down
2 changes: 1 addition & 1 deletion Switchcraft.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Switchcraft'
s.version = '1.3.0'
s.version = '1.3.1'
s.summary = 'Drop and go endpoint selector written in Swift.'
s.homepage = 'https://github.com/steamclock/Switchcraft'
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down

0 comments on commit b067a19

Please sign in to comment.