-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Added HKActivitySummary extensions #875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added HKActivitySummary extensions #875
Conversation
Codecov Report
@@ Coverage Diff @@
## master #875 +/- ##
=======================================
Coverage 95.47% 95.48%
=======================================
Files 100 101 +1
Lines 3405 3408 +3
=======================================
+ Hits 3251 3254 +3
Misses 154 154
Continue to review full report at Codecov.
|
Generated by 🚫 Danger |
let unit = HKUnit.count() | ||
let standHours = appleStandHours.doubleValue(for: unit) | ||
let goal = appleStandHoursGoal.doubleValue(for: unit) | ||
return standHours >= goal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know this API ... but there is the possibility of not having a goal set? what happens in this situation in doubleValue
return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In real life, the goal is always set when fetching HKActivitySummary
from HealthKit
Sources/SwifterSwift/HealthKit/HKActivitySummaryExtensions.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lhygilbert Thanks for the PR, overall looks good just some questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Then :)
cc @omaralbeik @guykogus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! that looks better :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments
var isStandGoalMet: Bool { | ||
return appleStandHoursGoal.compare(appleStandHours) != .orderedDescending | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make these all 1-liners.
var isStandGoalMet: Bool { | |
return appleStandHoursGoal.compare(appleStandHours) != .orderedDescending | |
} | |
var isStandGoalMet: Bool { appleStandHoursGoal.compare(appleStandHours) != .orderedDescending } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion, updated
} | ||
|
||
/// SwifterSwift: Check if exercise time goal is met | ||
var isExerciseGoalMet: Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the names should match more exactly.
var isExerciseGoalMet: Bool { | |
var isExerciseTimeGoalMet: Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
} | ||
|
||
/// SwifterSwift: Check if active energy goal is met | ||
var isEnergyGoalMet: Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
var isEnergyGoalMet: Bool { | |
var isEnergyBurnedGoalMet: Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Update to match new properties name Co-authored-by: Guy Kogus <guy.kogus@gmail.com>
Thank you for contributing to SwifterSwift! I've invited you to join the SwifterSwift GitHub organization - no pressure to accept! If you'd like more information on what that means, check out our contributing guidelines. Feel free to reach out if you have any questions! 😃 |
* 'master' of https://github.com/SwifterSwift/SwifterSwift: (79 commits) Helper functions for scrolling to the edges or by page of a scroll view (SwifterSwift#888) Add XCTest extension for comparing Color objects (SwifterSwift#889) Fix swiftlint error (SwifterSwift#894) Bump kramdown from 2.1.0 to 2.3.0 (SwifterSwift#891) Added note for UIView.addShadow() (SwifterSwift#890) loadFromNib(withClass) (SwifterSwift#885) constraint finders (widthConstraint, heightConstraint, leadingConstraint, trailingConstraint, topConstraint, bottomConstraint) (SwifterSwift#886) added String.regexEscaped (SwifterSwift#883) Make √ generic for FloatingPoint values (SwifterSwift#880) Update UITextField extensions (SwifterSwift#878) Added `masksToBounds` (IBInspectable) extension (SwifterSwift#877) Reinstate debounce function (SwifterSwift#869) `RandomAccessCollection`/`Collection` generalisations (SwifterSwift#863) Added HKActivitySummary extensions (SwifterSwift#875) Added new method for easily instantiating a view controller from a storyboard (SwifterSwift#860) Clean up code (SwifterSwift#864) fixed "".truncated crashed (SwifterSwift#866) Deprecated map(by:), compactMap(by:), filter(by:) (SwifterSwift#862) Overloaded 'contains' operator for string regex matching (SwifterSwift#858) Added convenient wrapper to asyncAfter (SwifterSwift#859) ... # Conflicts: # Sources/SwifterSwift/AppKit/NSColorExtensions.swift # Sources/SwifterSwift/AppKit/NSImageExtensions.swift # Sources/SwifterSwift/AppKit/NSViewExtensions.swift # Sources/SwifterSwift/CoreGraphics/CGColorExtensions.swift # Sources/SwifterSwift/CoreGraphics/CGFloatExtensions.swift # Sources/SwifterSwift/CoreGraphics/CGPointExtensions.swift # Sources/SwifterSwift/CoreGraphics/CGSizeExtensions.swift # Sources/SwifterSwift/Foundation/NSAttributedStringExtensions.swift # Sources/SwifterSwift/SwiftStdlib/StringExtensions.swift # SwifterSwift.xcodeproj/project.pbxproj # Tests/AppKitTests/NSColorExtensionsTests.swift # Tests/SwiftStdlibTests/StringExtensionsTests.swift
Checklist
@available
if not.