Skip to content

Commit

Permalink
refactor: simplify code to run on older swift version
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzablocki committed Oct 26, 2017
1 parent 8f6a84d commit 627f525
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion LifetimeTracker.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LifetimeTracker"
s.version = "1.1.0"
s.version = "1.1.1"
s.summary = "Framework to visually warn you when retain cycle / leak happens."
s.description = <<-DESC
Mini framework that can surface retain cycle issues sooner.
Expand Down
8 changes: 3 additions & 5 deletions Sources/LifetimeTracker+DashboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public final class LifetimeTrackerDashboardIntegration {

public func refreshUI(counts: [String: LifetimeTracker.Entry], fullEntries: [String: LifetimeTracker.Entry]) {
DispatchQueue.main.async {
self.window.isHidden = self.visibility.windowIsHidden(hasIssuesToDisplay: counts.hasIssuesToDisplay)
self.window.isHidden = self.visibility.windowIsHidden(hasIssuesToDisplay: self.hasIssuesToDisplay(counts: counts))
let vm = DashboardViewModel(summary: self.summary(from: counts), entries: self.entries(from: fullEntries))
self.vc.update(with: vm)
}
Expand Down Expand Up @@ -101,11 +101,9 @@ public final class LifetimeTrackerDashboardIntegration {
return "\(value.count) \(value.fullName): \(value.pointers.joined(separator: ", "))"
}
}
}

extension Dictionary where Key == String, Value == LifetimeTracker.Entry {
var hasIssuesToDisplay: Bool {
let aDetectedIssue = keys.first { self[$0]?.shouldDisplay == true }
func hasIssuesToDisplay(counts: [String: LifetimeTracker.Entry]) -> Bool {
let aDetectedIssue = counts.keys.first { counts[$0]?.shouldDisplay == true }
return aDetectedIssue != nil
}
}

0 comments on commit 627f525

Please sign in to comment.