{"id":15108577,"url":"https://github.com/beaunouvelle/faceaware","last_synced_at":"2025-10-20T13:59:38.437Z","repository":{"id":52232037,"uuid":"63958652","full_name":"BeauNouvelle/FaceAware","owner":"BeauNouvelle","description":"An extension that gives UIImageView the ability to focus on faces within an image.","archived":true,"fork":false,"pushed_at":"2020-08-01T12:44:20.000Z","size":2083,"stargazers_count":3023,"open_issues_count":4,"forks_count":227,"subscribers_count":65,"default_branch":"master","last_synced_at":"2024-05-16T03:48:15.608Z","etag":null,"topics":["carthage","cocoapods","detect-faces","extension","face-detection","hacktoberfest","ios","photos","swift","uiimageview"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"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/BeauNouvelle.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":"2016-07-22T14:15:00.000Z","updated_at":"2024-04-23T14:43:47.000Z","dependencies_parsed_at":"2022-08-20T18:20:38.453Z","dependency_job_id":null,"html_url":"https://github.com/BeauNouvelle/FaceAware","commit_stats":null,"previous_names":["beaunouvelle/aspectfillfaceaware"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeauNouvelle%2FFaceAware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeauNouvelle%2FFaceAware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeauNouvelle%2FFaceAware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeauNouvelle%2FFaceAware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeauNouvelle","download_url":"https://codeload.github.com/BeauNouvelle/FaceAware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234410188,"owners_count":18828154,"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":["carthage","cocoapods","detect-faces","extension","face-detection","hacktoberfest","ios","photos","swift","uiimageview"],"created_at":"2024-09-25T22:04:20.712Z","updated_at":"2025-09-27T07:31:36.637Z","avatar_url":"https://github.com/BeauNouvelle.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FaceAware\n\n\u003cimg src=\"https://raw.githubusercontent.com/BeauNouvelle/FaceAware/master/Images/avatarExample.png\" width=50%\u003e\n\nSometimes the aspect ratios of images we need to work with don't quite fit within the confines of our UIImageViews.\n\nIn most cases we can use AspectFill to fit the image to the bounds of a UIImageView without stretching or leaving whitespace, however when it comes to photos of people, it's quite often to have the faces cropped out if they're not perfectly centered.\n\nThis is where FaceAware comes in.\nIt will analyse an image either through `UIImageView`'s `image` property, or one you set using one of the built in functions and focus in on any faces it can find within.\n\nThe most common use for FaceAware is with avatars. \n\nWith FaceAware your users will no longer have to crop and adjust their profile pictures.\n\n\u003cimg src=\"https://raw.githubusercontent.com/BeauNouvelle/FaceAware/master/Images/largeExample.jpg\" width=50%\u003e\n\nBased on these two older projects:\n\n* [BetterFace-Swift](https://github.com/croath/UIImageView-BetterFace-Swift)\n* [FaceAwareFill](https://github.com/Julioacarrettoni/UIImageView_FaceAwareFill)\n\nBoth of which don't seem to be maintained anymore.\n\n## Requirements ##\n* Swift 5.1\n* iOS 8.0+\n* Xcode 11\n\n## Installation ##\n#### Manual ####\nSimply drag `UIImageView+FaceAware.swift` into your project. \n\n#### Carthage ####\n- Add `github \"BeauNouvelle/FaceAware\"` to your `Cartfile`\n\nMore information on installing and setting up Carthage can be found here:\nhttps://github.com/Carthage/Carthage\n\n#### Cocoapods ####\n- Add `pod 'FaceAware'` to your pod file.\n- Add `import FaceAware` to the top of your files where you wish to use it.\n\n## Usage ##\nThere are a few ways to get your image views focussing in on faces within images.\n\n#### Interface Builder ####\nThis is the easiest method and doesn't require writing any code.\nThe extension makes use of `@IBDesignable` and `@IBInspectable` so you can turn on focusOnFaces from within IB. However you won't actually see the extension working until you run your project.\n\n\u003cimg src=\"https://raw.githubusercontent.com/BeauNouvelle/FaceAware/master/Images/inspectable.png\" width=40%\u003e\n\n#### Code ####\nYou can set `focusOnFaces` to `true`.\n\n```swift\nsomeImageView.focusOnFaces = true\n```\nBe sure to set this *after* setting your image. If no image is present when this is called, there will be no faces to focus on.\n\n------\n\nAlternatively you can use:\n\n```swift\nsomeImageView.set(image: myImage, focusOnFaces: true)\n```\nWhich elimates the worry of not having an image previously set.\n\n------\n\nYou can also recieve a callback for when face detection and any image adjustments have been completed by passing in a closure to the `didFocusOnFaces` property.\n\n```swift\nsomeImageView.didFocusOnFaces = {\n     print(\"Did finish focussing\")\n}\n```\n\n#### Debugging ####\nFaceAware now features a debug mode which draws red squares around any detected faces within an image. To enable you can set the `debug` property to true.\n\n```swift\nsomeImageView.debug = true\n```\n\nYou can also set this flag within interface builder.\n\n\n## More help? Questions? ##\nReach out to me on Twitter [@beaunouvelle](https://twitter.com/BeauNouvelle)\nAlso, if you're using this in your project and you like it, please let me know so I can continue working on it!\n\n## Future Plans ##\n- [ ] Add an option to only focus on largest/closest face in photo.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeaunouvelle%2Ffaceaware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeaunouvelle%2Ffaceaware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeaunouvelle%2Ffaceaware/lists"}