diff --git a/README.md b/README.md index 139b9c3..b6368c6 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 diff --git a/Tests/SwiftyCropTests/SwiftyCropTests.swift b/Tests/SwiftyCropTests/SwiftyCropTests.swift index 3e0877f..d79f68c 100644 --- a/Tests/SwiftyCropTests/SwiftyCropTests.swift +++ b/Tests/SwiftyCropTests/SwiftyCropTests.swift @@ -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) } }