Skip to content

Conversation

lhygilbert
Copy link
Contributor

@lhygilbert lhygilbert commented Jul 4, 2020

Checklist

  • I checked the Contributing Guidelines before creating this request.
  • New extensions are written in Swift 5.0.
  • New extensions support iOS 10.0+ / tvOS 9.0+ / macOS 10.10+ / watchOS 2.0+, or use @available if not.
  • I have added tests for new extensions, and they passed.
  • All extensions have a clear comments explaining their functionality, all parameters and return type in English.
  • All extensions are declared as public.
  • I have added a changelog entry describing my changes.

@codecov
Copy link

codecov bot commented Jul 4, 2020

Codecov Report

Merging #875 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #875   +/-   ##
=======================================
  Coverage   95.47%   95.48%           
=======================================
  Files         100      101    +1     
  Lines        3405     3408    +3     
=======================================
+ Hits         3251     3254    +3     
  Misses        154      154           
Flag Coverage Δ
#ios 95.58% <100.00%> (+<0.01%) ⬆️
#macos 97.08% <ø> (-1.46%) ⬇️
#tvos 93.56% <ø> (ø)
Impacted Files Coverage Δ
...rSwift/HealthKit/HKActivitySummaryExtensions.swift 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f75ea86...b1407db. Read the comment docs.

@SwifterSwiftBot
Copy link

SwifterSwiftBot commented Jul 4, 2020

4 Messages
📖 Thank you for submitting a pull request to SwifterSwift. The team will review your submission as soon as possible.
📖 iOS: Executed 683 tests, with 0 failures (0 unexpected) in 32.570 (33.758) seconds
📖 tvOS: Executed 645 tests, with 0 failures (0 unexpected) in 4.113 (4.636) seconds
📖 macOS: Executed 511 tests, with 0 failures (0 unexpected) in 4.069 (4.288) seconds

Generated by 🚫 Danger

let unit = HKUnit.count()
let standHours = appleStandHours.doubleValue(for: unit)
let goal = appleStandHoursGoal.doubleValue(for: unit)
return standHours >= goal
Copy link
Member

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?

Copy link
Contributor Author

@lhygilbert lhygilbert Jul 4, 2020

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

Copy link
Member

@LucianoPAlmeida LucianoPAlmeida left a 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

LucianoPAlmeida
LucianoPAlmeida previously approved these changes Jul 4, 2020
Copy link
Member

@LucianoPAlmeida LucianoPAlmeida left a 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

LucianoPAlmeida
LucianoPAlmeida previously approved these changes Jul 4, 2020
Copy link
Member

@LucianoPAlmeida LucianoPAlmeida left a 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 :)

Copy link
Contributor

@guykogus guykogus left a 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

Comment on lines 17 to 19
var isStandGoalMet: Bool {
return appleStandHoursGoal.compare(appleStandHours) != .orderedDescending
}
Copy link
Contributor

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.

Suggested change
var isStandGoalMet: Bool {
return appleStandHoursGoal.compare(appleStandHours) != .orderedDescending
}
var isStandGoalMet: Bool { appleStandHoursGoal.compare(appleStandHours) != .orderedDescending }

Copy link
Contributor Author

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 {
Copy link
Contributor

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.

Suggested change
var isExerciseGoalMet: Bool {
var isExerciseTimeGoalMet: Bool {

Copy link
Contributor Author

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Suggested change
var isEnergyGoalMet: Bool {
var isEnergyBurnedGoalMet: Bool {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

LucianoPAlmeida
LucianoPAlmeida previously approved these changes Jul 5, 2020
@LucianoPAlmeida LucianoPAlmeida requested a review from guykogus July 5, 2020 15:28
Update to match new properties name

Co-authored-by: Guy Kogus <guy.kogus@gmail.com>
@guykogus guykogus merged commit 3739cd9 into SwifterSwift:master Jul 5, 2020
@SD10
Copy link
Member

SD10 commented Jul 5, 2020

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! 😃

nasircsms pushed a commit to nasircsms/SwifterSwift that referenced this pull request Aug 26, 2020
* '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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants