[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7032":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":14,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":20,"defaultBranch":21,"hasWiki":19,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},7032,"FaceAware","BeauNouvelle\u002FFaceAware","BeauNouvelle","An extension that gives UIImageView the ability to focus on faces within an image.","",null,"Swift",3004,223,1,4,0,59.15,"MIT License",true,false,"master",[23,24,25,26,27,28,29,30,31,32],"carthage","cocoapods","detect-faces","extension","face-detection","hacktoberfest","ios","photos","swift","uiimageview","2026-06-12 04:00:32","# FaceAware\n\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002FBeauNouvelle\u002FFaceAware\u002Fmaster\u002FImages\u002FavatarExample.png\" width=50%>\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:\u002F\u002Fraw.githubusercontent.com\u002FBeauNouvelle\u002FFaceAware\u002Fmaster\u002FImages\u002FlargeExample.jpg\" width=50%>\n\nBased on these two older projects:\n\n* [BetterFace-Swift](https:\u002F\u002Fgithub.com\u002Fcroath\u002FUIImageView-BetterFace-Swift)\n* [FaceAwareFill](https:\u002F\u002Fgithub.com\u002FJulioacarrettoni\u002FUIImageView_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\u002FFaceAware\"` to your `Cartfile`\n\nMore information on installing and setting up Carthage can be found here:\nhttps:\u002F\u002Fgithub.com\u002FCarthage\u002FCarthage\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:\u002F\u002Fraw.githubusercontent.com\u002FBeauNouvelle\u002FFaceAware\u002Fmaster\u002FImages\u002Finspectable.png\" width=40%>\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:\u002F\u002Ftwitter.com\u002FBeauNouvelle)\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\u002Fclosest face in photo.\n","FaceAware 是一个为 UIImageView 添加面部识别功能的扩展，使图片展示时能够自动聚焦于人脸。该项目使用 Swift 语言开发，通过分析 UIImageView 中的图像或用户设置的图像来检测并聚焦于其中的人脸，有效解决了因图像比例不匹配而导致人脸被裁剪的问题。其主要特点是易于集成、支持多种安装方式（如 Carthage 和 CocoaPods），并且提供了界面构建器和代码两种使用方式以满足不同开发者的需求。特别适用于需要显示用户头像的应用场景，确保用户无需手动裁剪调整即可获得最佳显示效果。",2,"2026-06-11 03:10:13","top_language"]