Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frandepascuali/constraintsmonitor
A tool to understand constraints warnings. Nicer constraints warnings, with no setup needed.
https://github.com/frandepascuali/constraintsmonitor
autolayout constraints constraints-warnings ios nslayoutconstraint objective-c swift uikit warnings
Last synced: 24 days ago
JSON representation
A tool to understand constraints warnings. Nicer constraints warnings, with no setup needed.
- Host: GitHub
- URL: https://github.com/frandepascuali/constraintsmonitor
- Owner: FranDepascuali
- License: mit
- Created: 2020-05-25T18:56:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-02T22:14:09.000Z (over 4 years ago)
- Last Synced: 2025-01-16T21:48:16.852Z (28 days ago)
- Topics: autolayout, constraints, constraints-warnings, ios, nslayoutconstraint, objective-c, swift, uikit, warnings
- Language: Swift
- Homepage:
- Size: 191 KB
- Stars: 16
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ConstraintsMonitor
A tool to understand constraints warnings, only adding it as a dependency.###
Without **ConstraintsMonitor**:
```
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"",
"",
"",
"",
"",
""
)Will attempt to recover by breaking constraint
```
With **ConstraintsMonitor**:
```
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"UIViewControllerWrapperView.MyView.height == 896.0 (Did you set translatesAutoresizingMaskIntoConstraints = false?)",
"MyView.UIView.height == 200.0 ",
"MyView.UIView.top == UIViewControllerWrapperView.MyView.top (constant: 0.0)",
"MyView.UIView.top == UIView.bottom (constant: 0.0)",
"MyView.UIView.bottom == UIViewControllerWrapperView.MyView.bottom (constant: 0.0)",
"MyView.UIView.height == UIViewControllerWrapperView.MyView.height (multiplier: 0.200)"
)Will attempt to recover by breaking constraint
MyView.UIView.height == 200.0Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful.
```## Why?
I was tired of looking for constraints issues and realizing what was really the issue, so I created this mini tool for printing nicer constraints## Installation
* [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html):
```ruby
pod 'ConstraintsMonitor'
```* [Swift Package Manager](https://swift.org/package-manager/):
```swift
dependencies: [
.package(url: "https://github.com/FranDepascuali/ConstraintsMonitor.git", from: "1.0.1")
]
```## Usage
Just by including this lib in your project, you will see nicer constraints warnings## Key Features
* Use an identifier for the constraint if supplied.
* Use the view identifier or the class name if the view is a subclass of UIView.
* Show the parent view, so it's easier to know where to locate the issue.## How does it work?
By overriding the description property of the `NSLayoutConstraint` involved, we have a nicer way of viewing constraints.## Author
You can check my blog at https://deep-thought.netlify.com/ or [@FranDepascuali](https://twitter.com/FranDepascuali) in twitter.## License
ConstraintsMonitor is available under the MIT license. See the LICENSE file for more info.