Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmytro-anokhin/view-comparison
Unit Testing UIView
https://github.com/dmytro-anokhin/view-comparison
swift4 uikit uiview unit-testing
Last synced: 25 days ago
JSON representation
Unit Testing UIView
- Host: GitHub
- URL: https://github.com/dmytro-anokhin/view-comparison
- Owner: dmytro-anokhin
- Created: 2017-09-27T05:46:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-31T02:08:48.000Z (about 7 years ago)
- Last Synced: 2024-11-07T18:34:41.533Z (3 months ago)
- Topics: swift4, uikit, uiview, unit-testing
- Language: Swift
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## ViewComparison ##
ViewComparison is a function to compare hierarchies of two views. This is useful for unit testing purposes. For instance, verifying that views hierarchy created from JSON corresponds to expected one.
The function is implemented as extension of `UIView`.
### Usage ###
- Include **UIView+Compare.swift** file to your project.Implementation wrapped into framework for unit testing purpose. There's no need to link with the framework in real projects.
Here's example testing if layouts of two hierarchies are alike:
```swift
XCTAssertTrue(view1.compareHierarchy(to: view2, compare: { $0.frame == $1.frame }))
```