{"id":1207,"url":"https://github.com/AlexLittlejohn/ALCameraViewController","last_synced_at":"2025-07-30T20:32:48.908Z","repository":{"id":34430476,"uuid":"38363621","full_name":"AlexLittlejohn/ALCameraViewController","owner":"AlexLittlejohn","description":"A camera view controller with custom image picker and image cropping.","archived":true,"fork":false,"pushed_at":"2022-07-01T08:06:36.000Z","size":1742,"stargazers_count":2033,"open_issues_count":75,"forks_count":389,"subscribers_count":41,"default_branch":"master","last_synced_at":"2024-09-27T04:41:05.004Z","etag":null,"topics":["camera","cropping","ios","photos","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexLittlejohn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-01T09:56:38.000Z","updated_at":"2024-09-03T16:48:56.000Z","dependencies_parsed_at":"2022-08-08T01:00:43.399Z","dependency_job_id":null,"html_url":"https://github.com/AlexLittlejohn/ALCameraViewController","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexLittlejohn%2FALCameraViewController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexLittlejohn%2FALCameraViewController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexLittlejohn%2FALCameraViewController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexLittlejohn%2FALCameraViewController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexLittlejohn","download_url":"https://codeload.github.com/AlexLittlejohn/ALCameraViewController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228187585,"owners_count":17882329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["camera","cropping","ios","photos","swift"],"created_at":"2024-01-05T20:15:41.277Z","updated_at":"2024-12-04T20:31:07.378Z","avatar_url":"https://github.com/AlexLittlejohn.png","language":"Swift","readme":"# ⚠️ This project is unmaintained\n\n---\n\n# ALCameraViewController\nA camera view controller with custom image picker and image cropping.\n\n![camera](https://cloud.githubusercontent.com/assets/932822/8455694/c61de812-2006-11e5-85c0-a57e3d980561.jpg)\n![cropper](https://cloud.githubusercontent.com/assets/932822/8455697/c627ac44-2006-11e5-82be-7f96e73d9b1f.jpg)\n![library](https://cloud.githubusercontent.com/assets/932822/8455695/c620ebb6-2006-11e5-9c61-75a81870c9de.jpg)\n![permissions](https://cloud.githubusercontent.com/assets/932822/8455696/c62157fe-2006-11e5-958f-849cabf541ca.jpg)\n\n### Features\n\n- [x] Front facing and rear facing camera\n- [x] Simple and clean look\n- [x] Custom image picker with permission checking\n- [x] Image cropping\n- [x] Flash light\n- [x] Zoom\n- [x] Tap to focus\n\n### Installation \u0026 Requirements\nThis project requires Xcode 9 to run and compiles with swift 4\n\u003e Note: This library makes use of the AVFoundation camera API's which are unavailable on the iOS simulator. You'll need a real device to run it.\n\nCocoaPods:\nAdd the following to your Podfile:\n\n```ruby\npod 'ALCameraViewController'\n```\n\u003e For swift 3.2 support\n\n```ruby\npod 'ALCameraViewController', '~\u003e 2.0.3'\n```\n\nCarthage:\n\n```ruby\ngithub \"alexlittlejohn/ALCameraViewController\"\n```\n\n\n### Privacy (iOS 10) ###\nIf you are building your app with iOS 10 or newer, you need to add two privacy keys to your app to allow the usage of the camera and photo library, or your app will crash.\n\nAdd the keys below to your `Info.plist`, adding strings with the description you want to provide when prompting the user.\n\n```\n    NSPhotoLibraryUsageDescription\n    NSCameraUsageDescription\n```\n\n### Usage\n\nTo use this component couldn't be simpler.\nAdd `import ALCameraViewController` to the top of your controller file.\n\nIn the viewController\n```swift\n\nlet cameraViewController = CameraViewController { [weak self] image, asset in\n\t// Do something with your image here.\n\tself?.dismiss(animated: true, completion: nil)\n}\n\npresent(cameraViewController, animated: true, completion: nil)\n```\n\n### Parameters\n\nThere are a number of configurable options available for `CameraViewController`\n\n```swift\ninit(croppingParameters: CroppingParameters = CroppingParameters(),\n     allowsLibraryAccess: Bool = true,\n     allowsSwapCameraOrientation: Bool = true,\n     allowVolumeButtonCapture: Bool = true,\n     completion: @escaping CameraViewCompletion)\n```\n\nThe Cropping Parameters struct accepts the following parameters\n\n```swift\ninit(isEnabled: Bool = false,\n     allowResizing: Bool = true,\n     allowMoving: Bool = true,\n     minimumSize: CGSize = CGSize(width: 60, height: 60))\n```\n\nThe success parameter returns a `UIImage?` and a `PHAsset?` for more advanced use cases.\nIf the user canceled photo capture then both of these options will be `nil`\n\n```swift\ntypealias CameraViewCompletion = (UIImage?, PHAsset?) -\u003e Void\n```\n\u003e Note: To prevent retain cycles, it is best to use a `[weak self]` reference within the success parameter\n\n### Other usage options\n\nYou can also instantiate the image picker component by itself as well.\n```swift\n\nlet croppingEnabled = true\n\n/// Provides an image picker wrapped inside a UINavigationController instance\nlet imagePickerViewController = CameraViewController.imagePickerViewController(croppingEnabled: croppingEnabled) { [weak self] image, asset in\n\t\t// Do something with your image here.\n\t \t// If cropping is enabled this image will be the cropped version\n\n    self?.dismiss(animated: true, completion: nil)\n}\n\npresent(imagePickerViewController, animated: true, completion: nil)\n\n```\n\nFor more control you can create it directly.\n\u003e Note: This approach requires some familiarity with the PhotoKit library provided by apple\n\n```swift\nimport Photos\n\nlet imagePickerViewController = PhotoLibraryViewController()\nimagePickerViewController.onSelectionComplete = { asset in\n\n\t\t// The asset could be nil if the user doesn't select anything\n\t\tguard let asset = asset else {\n\t\t\treturn\n\t\t}\n\n    // Provides a PHAsset object\n\t\t// Retrieve a UIImage from a PHAsset using\n\t\tlet options = PHImageRequestOptions()\n    options.deliveryMode = .highQualityFormat\n    options.isNetworkAccessAllowed = true\n\n\t\tPHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize, contentMode: .aspectFill, options: options) { image, _ in\n        if let image = image {\n\t\t\t\t\t\t// Do something with your image here\n        }\n    }\n}\n\npresent(imagePickerViewController, animated: true, completion: nil)\n\n```\n\n\n## License\nALCameraViewController is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":["Hardware","Libs","Hardware [🔝](#readme)","UI"],"sub_categories":["Camera","Hardware","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlexLittlejohn%2FALCameraViewController","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAlexLittlejohn%2FALCameraViewController","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlexLittlejohn%2FALCameraViewController/lists"}