Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


PetFocus is an image view that automatically centers images on any pets (dogs or cats) shown in the image. It's useful when cropping photos to squares or circles. Pets don't always cooperate when they're having their photos taken, so PetFocus helps show the best part of any photo, no matter how it actually turned out.

PetFocus is usable in projects deployed on iOS 10 and up, but will only perform pet-focused cropping on iOS 13. When running on versions older than iOS 13, PetFocus will fall back to the default cropping behavior.

Read more about the creation of PetFocus on the Rover Engineering blog.


Swift Package Manager

In Xcode 11, you can use the new Swift Package Manager integration to add PetFocus to your project. Select the menu item File > Swift Packages > Add Package Dependency… and enter in the PetFocus repository URL to add the package to your project:


If your project doesn't currently use Swift Package Manager, you can also use Carthage. If your project is already using Carthage, just add PetFocus to your Cartfile:

github "roverdotcom/pet-focus" == 0.0.2


PetFocus can also be added via CocoaPods. Simply add the following to your Podfile:

pod 'PetFocus', :git => ''


PetFocus provides PetFocusedImageView, a drop-in replacement for UIImageView. It can be used in exactly the same way as a UIImageView.

import PetFocus

class PetViewController: UIViewController {
    func viewDidLoad() {
        let imageView = PetFocusedImageView(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
        imageView.image = myDogImage


PetFocus is available under the MIT License. See the LICENSE file for details.