Skip to content
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

Add scaled(toMaxSize:NSSize) to NSImage, including a test #291

Merged
merged 6 commits into from
Nov 1, 2017

Conversation

buddax2
Copy link
Contributor

@buddax2 buddax2 commented Oct 20, 2017

Add a function to NSImage to be able to scale an image to some maximum size. It could be useful for creating thumbnails.

Checklist

  • I checked the Contributing Guidelines before creating this request.
  • New extensions are written in Swift 4.
  • New extensions support iOS 8.0+ / tvOS 9.0+ / macOS 10.10+ / watchOS 2.0+.
  • 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.

@SwifterSwiftBot
Copy link

SwifterSwiftBot commented Oct 20, 2017

1 Message
📖 Thank you for submitting a pull request to SwifterSwift. The team will review your submission as soon as possible.

Generated by 🚫 Danger

@codecov
Copy link

codecov bot commented Oct 20, 2017

Codecov Report

Merging #291 into master will increase coverage by 0.15%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #291      +/-   ##
==========================================
+ Coverage   94.41%   94.56%   +0.15%     
==========================================
  Files          99      100       +1     
  Lines        5494     5555      +61     
==========================================
+ Hits         5187     5253      +66     
+ Misses        307      302       -5
Flag Coverage Δ
#ios 94.35% <ø> (+0.14%) ⬆️
#osx 61.18% <100%> (+0.52%) ⬆️
#tvos 89.31% <ø> (+0.19%) ⬆️
Impacted Files Coverage Δ
Tests/AppKitTests/NSImageExtensionsTests.swift 100% <100%> (ø)
...es/Extensions/SwiftStdlib/OptionalExtensions.swift 100% <0%> (ø) ⬆️
Tests/FoundationTests/DateExtensionsTests.swift 94.97% <0%> (+0.26%) ⬆️
Sources/Extensions/Foundation/DateExtensions.swift 100% <0%> (+1.71%) ⬆️
...sts/SwiftStdlibTests/OptionalExtensionsTests.swift 93.93% <0%> (+5.05%) ⬆️

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 9c67b5d...cfd8997. Read the comment docs.

///
/// - Parameter toMaxSize: maximum size
/// - Returns: scaled NSImage
public func scaled(toMaxSize: NSSize) -> NSImage {
Copy link
Member

Choose a reason for hiding this comment

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

public func scaled(to maxSize: NSSize) -> NSImage may be better?

Copy link
Member

Choose a reason for hiding this comment

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

actually maybe not, loses the expressiveness of it being a max size.

@SD10
Copy link
Member

SD10 commented Oct 25, 2017

Thank you for your contribution @buddax2. Can you add a CHANGELOG entry for this?

@buddax2
Copy link
Contributor Author

buddax2 commented Oct 26, 2017

@SD10 sure I can. Should I add a new release section for this (v4.0.2)?

@SD10
Copy link
Member

SD10 commented Oct 26, 2017

No @buddax2 It just goes under the Next Release section. Follow the previous CHANGELOG as a guide

EDIT: Can you also add an entry for #296? We forgot this one 😅

@buddax2
Copy link
Contributor Author

buddax2 commented Oct 26, 2017

@SD10 can I add an entry for #296 in this PR? :)

@SD10
Copy link
Member

SD10 commented Oct 26, 2017

Sure things @buddax2 👍

@buddax2
Copy link
Contributor Author

buddax2 commented Oct 26, 2017

@SD10 done

Copy link
Member

@SD10 SD10 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution @buddax2 Sorry for the delay!

@SD10 SD10 merged commit f867528 into SwifterSwift:master Nov 1, 2017
@omaralbeik
Copy link
Member

Thank you @buddax2 @SD10 👍

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.

4 participants