Skip to content

Implementation of aspectRatio methods - #84

Merged
lucdion merged 3 commits into
masterfrom
aspect_ratio
Sep 29, 2017
Merged

lucdion merged 3 commits into
masterfrom
aspect_ratio

Conversation

@lucdion

@lucdion lucdion commented Sep 27, 2017 •

Copy link
Copy Markdown
Member
  • Add aspectRatio methods:

    • aspectRatio(_ ratio: CGFloat):
      Set the view aspect ratio. If a single dimension is set (either width or height), the aspect ratio will be used to compute the other dimension.
      • AspectRatio is defined as the ratio between the width and the height (width / height).
      • An aspect ratio of 2 means the width is twice the size of the height.
      • AspectRatio respects the min (minWidth/minHeight) and the max (maxWidth/maxHeight) dimensions of an item.
        Set all margins using an UIEdgeInsets.
        This method is particularly useful to set all margins using iOS 11 UIView.safeAreaInsets
    • aspectRatio(of view: UIView):
      Set the view aspect ratio using another UIView's aspect ratio.

    AspectRatio is applied only if a single dimension (either width or height) can be determined,
    in that case the aspect ratio will be used to compute the other dimension.

    • AspectRatio is defined as the ratio between the width and the height (width / height).
    • AspectRatio respects the min (minWidth/minHeight) and the max (maxWidth/maxHeight)
      dimensions of an item.
  • aspectRatio():
    If the layouted view is an UIImageView, this method will set the aspectRatio using
    the UIImageView's image dimension.

    For other types of views, this method as no impact.

@codecov-io

codecov-io commented Sep 27, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #84 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #84      +/-   ##
==========================================
+ Coverage   99.32%   99.35%   +0.03%     
==========================================
  Files          15       17       +2     
  Lines        3694     3906     +212     
==========================================
+ Hits         3669     3881     +212     
  Misses         25       25
Impacted Files Coverage Δ
Tests/MinMaxWidthHeightSpec.swift 100% <100%> (ø) ⬆️
Tests/AdjustSizeSpec.swift 100% <100%> (ø) ⬆️
Tests/AspectRatioTests.swift 100% <100%> (ø)
Tests/UIImage+Color.swift 100% <100%> (ø)

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 2c55b0a...5a3fe9a. Read the comment docs.

@lucdion
lucdion merged commit 1b2c341 into master Sep 29, 2017
@lucdion
lucdion deleted the aspect_ratio branch September 29, 2017 22:37
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.

2 participants