Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2 from etlasky/etlasky/add-compute-size
Browse files Browse the repository at this point in the history
Add compute size
  • Loading branch information
jeffaburt authored Feb 14, 2019
2 parents ee24039 + 5f31b1e commit dba4ca9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SafeAreaInputAccessoryViewWrapperView.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SafeAreaInputAccessoryViewWrapperView'
s.version = '1.0.0'
s.version = '1.0.1'
s.screenshot = 'https://user-images.githubusercontent.com/2835199/31238567-5c96c3f2-a9c8-11e7-86f5-170ebc372cdc.png'
s.summary = 'SafeAreaInputAccessoryViewWrapperView provides a way to wrap custom inputAccessoryView views to respect bottom safe area layouts.'
s.description = <<-DESC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,16 @@ public class SafeAreaInputAccessoryViewWrapperView: UIView {
return .zero
}
}

public extension SafeAreaInputAccessoryViewWrapperView {
/// Returns the size of this wrapper view by computing it from the size of it's content.
/// NOTE: This is not used internally, but rather, it's a convenience helper for views that
/// might need to adjust their constraints or insets based on this size.
/// This will also work when changing the size of the application window due to iPad Multitasking.
public func computedSize() -> CGSize {
return systemLayoutSizeFitting(CGSize(width: UIApplication.shared.keyWindow?.bounds.width ?? UIScreen.main.bounds.width,
height: .greatestFiniteMagnitude),
withHorizontalFittingPriority: .required,
verticalFittingPriority: .fittingSizeLevel)
}
}

0 comments on commit dba4ca9

Please sign in to comment.