Skip to content

Commit 2e1a9f3

Browse files
authored
Merge pull request #453 from woxtu/allowed-aspect-ratios
Add allowedAspectRatios property
2 parents fd40358 + 47a5980 commit 2e1a9f3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Swift/CropViewController/CropViewController.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,15 @@ open class CropViewController: UIViewController, TOCropViewControllerDelegate {
311311
get { return toCropViewController.excludedActivityTypes }
312312
}
313313

314+
/**
315+
An array of `TOCropViewControllerAspectRatioPreset` enum values denoting which
316+
aspect ratios the crop view controller may display (Default is nil. All are shown)
317+
*/
318+
public var allowedAspectRatios: [CropViewControllerAspectRatioPreset]? {
319+
set { toCropViewController.allowedAspectRatios = newValue?.map { NSNumber(value: $0.rawValue) } }
320+
get { return toCropViewController.allowedAspectRatios?.compactMap { CropViewControllerAspectRatioPreset(rawValue: $0.intValue) } }
321+
}
322+
314323
/**
315324
When the user hits cancel, or completes a
316325
UIActivityViewController operation, this block will be called,

0 commit comments

Comments
 (0)