-
Notifications
You must be signed in to change notification settings - Fork 143
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 automatic sizeThatFits computation for views #216
Merged
Merged
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9e3b4f8
Pod install
antoinelamy 089ebe9
Working prototype
antoinelamy faeb598
Code review modifications
antoinelamy 3437838
Revert "Adjust to Container Size" sample code
antoinelamy 97aba2e
Change Travis target OS from 13.2 to 13.2.2
antoinelamy 511be9e
Update test platform to xcode 11.5 iOS 13.5
antoinelamy 9050899
Use tvOS 13.4
antoinelamy 833a710
tvOS 13.4 (some refs remaining)
antoinelamy ff9caff
Again...
antoinelamy c55f4f6
Fix recursive usage of auto sizing
antoinelamy e959028
Fix rectWithMargins calculation on tvOS
antoinelamy 57e25ec
Use PEdgeInsets instead of UIEdgeInsets
antoinelamy 0544e17
Fix simulator versions
antoinelamy df408dc
Use consistent version of Swift across project
antoinelamy 457b17b
Specify swift version in podspec
antoinelamy a9c4ae8
Put setRect in a else condition
antoinelamy c0890eb
Add AutoSizing Example
antoinelamy 83d420d
Add documentation
antoinelamy bba716a
Move exemple in a more logical order
antoinelamy 142acdf
Readme adjustments
antoinelamy b40beb7
Indent Readme with spaces instead of tabs
antoinelamy af7633d
Readme adjustments
antoinelamy b702f19
Wording
antoinelamy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
language: objective-c | ||
osx_image: xcode11.2 | ||
osx_image: xcode11.5 | ||
|
||
cache: | ||
- bundler | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
Example/PinLayoutSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#if os(iOS) || os(tvOS) | ||
import UIKit | ||
#else | ||
import AppKit | ||
#endif | ||
|
||
public protocol AutoSizeCalculable { | ||
func setAutoSizingRect(_ rect: CGRect, margins: PEdgeInsets) | ||
func autoSizeThatFits(_ size: CGSize, layoutClosure: () -> Void) -> CGSize | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really would like to extract that function out of the UIView conformance extension but the only thing that prevent me to do so is the call to
let adjustedRect = Coordinates<View>.adjustRectToDisplayScale(rect)
. I think it would make sense to add adisplayScale
property on theLayoutable
protocol and perform that transformation before callingsetRect
. We really want the resulting rect to be the same in both layout and auto sizing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have perform the changes to do this but I believe it would make more sense in a separate PR as it also fix an issue in the current production code.