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

Commit dba4ca9

Browse files
authored
Merge pull request #2 from etlasky/etlasky/add-compute-size
Add compute size
2 parents ee24039 + 5f31b1e commit dba4ca9

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

SafeAreaInputAccessoryViewWrapperView.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'SafeAreaInputAccessoryViewWrapperView'
3-
s.version = '1.0.0'
3+
s.version = '1.0.1'
44
s.screenshot = 'https://user-images.githubusercontent.com/2835199/31238567-5c96c3f2-a9c8-11e7-86f5-170ebc372cdc.png'
55
s.summary = 'SafeAreaInputAccessoryViewWrapperView provides a way to wrap custom inputAccessoryView views to respect bottom safe area layouts.'
66
s.description = <<-DESC

SafeAreaInputAccessoryViewWrapperView/Classes/SafeAreaInputAccessoryViewWrapperView.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,16 @@ public class SafeAreaInputAccessoryViewWrapperView: UIView {
7676
return .zero
7777
}
7878
}
79+
80+
public extension SafeAreaInputAccessoryViewWrapperView {
81+
/// Returns the size of this wrapper view by computing it from the size of it's content.
82+
/// NOTE: This is not used internally, but rather, it's a convenience helper for views that
83+
/// might need to adjust their constraints or insets based on this size.
84+
/// This will also work when changing the size of the application window due to iPad Multitasking.
85+
public func computedSize() -> CGSize {
86+
return systemLayoutSizeFitting(CGSize(width: UIApplication.shared.keyWindow?.bounds.width ?? UIScreen.main.bounds.width,
87+
height: .greatestFiniteMagnitude),
88+
withHorizontalFittingPriority: .required,
89+
verticalFittingPriority: .fittingSizeLevel)
90+
}
91+
}

0 commit comments

Comments
 (0)