Skip to content

Commit

Permalink
Adjust README and Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benedom committed Jan 23, 2024
1 parent d128aa7 commit 374da20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ You can also configure `SwiftyCropView` by passing a `SwiftyCropConfiguration`.
| ----------- | ----------- |
| `maxMagnificationScale` | `CGFloat`: The maximum scale factor that the image can be magnified while cropping. Defaults to `4.0`. |
| `maskRadius` | `CGFloat`: The radius of the mask used for cropping. Defaults to `130`. A good way is to make it dependend on the screens size. |
| `cropImageCircular` | `Bool`: When using the cropping mask `circle`, whether the resulting image should also be masked as circle. Defaults to `false`. |

Create a configuration like this:
```swift
let configuration = SwiftyCropConfiguration(
maxMagnificationScale = 4.0,
maskRadius: 130
maskRadius: 130,
cropImageCircular: false
)
```
and use it like this:
Expand All @@ -164,6 +166,8 @@ and use it like this:

All issue reports, feature requests, pull requests and GitHub stars are welcomed and much appreciated.

Thanks to @leoz for adding the circular crop mode 🎉

## ✍️ Author

Benedikt Betz & CHECK24
Expand Down
7 changes: 6 additions & 1 deletion Tests/SwiftyCropTests/SwiftyCropTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import XCTest

final class SwiftyCropTests: XCTestCase {
func testConfigurationInit() {
let configuration = SwiftyCropConfiguration(maxMagnificationScale: 1.0, maskRadius: 1.0)
let configuration = SwiftyCropConfiguration(
maxMagnificationScale: 1.0,
maskRadius: 1.0,
cropImageCircular: true
)
XCTAssertEqual(configuration.maxMagnificationScale, 1.0)
XCTAssertEqual(configuration.maskRadius, 1.0)
XCTAssertEqual(configuration.cropImageCircular, true)
}
}

0 comments on commit 374da20

Please sign in to comment.