Skip to content
This repository has been archived by the owner on Jan 3, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
msaps committed Mar 19, 2018
2 parents f3179b1 + 2957d64 commit 230ea39
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion AutoInsetter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.swift_version = "4.0"

s.version = "1.2.1"
s.version = "1.2.2"
s.summary = "Provide auto insetting capabilities to view controllers."
s.description = <<-DESC
Auto Inset engine that can automatically handle custom insetting of view controllers.
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ All notable changes to this project will be documented in this file.
`AutoInsetter` adheres to [Semantic Versioning](http://semver.org/).

#### 1.x Releases
- `1.2.x` Releases - [1.2.0](#120) | [1.2.1](#121)
- `1.2.x` Releases - [1.2.0](#120) | [1.2.1](#121) | [1.2.2](#122)
- `1.1.x` Releases - [1.1.0](#110)
- `1.0.x` Releases - [1.0.0](#100)

---

## [1.2.2](https://github.com/uias/AutoInsetter/releases/tag/1.2.2)
Released on 2018-03-19

#### Fixed
- Fixed issue where `UITableViewController` and `UICollectionViewController` would not inset correctly.
- by [msaps](https://github.com/msaps)

## [1.2.1](https://github.com/uias/AutoInsetter/releases/tag/1.2.1)
Released on 2018-02-11

Expand Down
13 changes: 7 additions & 6 deletions Sources/AutoInsetter/AutoInsetter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public final class AutoInsetter {

scrollView.contentInset = requiredContentInset
scrollView.scrollIndicatorInsets = requiredContentInset

// only update contentOffset if the top contentInset has updated.
if isTopInsetChanged {
var contentOffset = scrollView.contentOffset
Expand Down Expand Up @@ -98,10 +98,6 @@ private extension AutoInsetter {
func calculateActualRequiredContentInset(for scrollView: UIScrollView,
from requiredInsetSpec: AutoInsetSpec,
in viewController: UIViewController) -> UIEdgeInsets {
guard let superview = scrollView.superview else {
return scrollView.contentInset
}

viewController.view.layoutIfNeeded()

let requiredContentInset = requiredInsetSpec.allRequiredInsets
Expand All @@ -112,7 +108,12 @@ private extension AutoInsetter {

if isEmbeddedViewController(viewController) { // Embedded VC is always full canvas
proposedContentInset = requiredContentInset
} else {

} else { // Standard View controller

guard let superview = scrollView.superview else {
return scrollView.contentInset
}

let relativeFrame = viewController.view.convert(scrollView.frame, from: superview)
let relativeTopInset = max(requiredContentInset.top - relativeFrame.minY, 0.0)
Expand Down
2 changes: 1 addition & 1 deletion Sources/AutoInsetter/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down

0 comments on commit 230ea39

Please sign in to comment.