Swiftpack.co -  kylebshr/ScreenCorners as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Check the display corner radius of an iOS device
.package(url: "https://github.com/kylebshr/ScreenCorners.git", from: "v1.0.1")


Check the corner radius of an iPhone / iPad display.


Adds a displayCornerRadius property to UIScreen, which reads the private _displayCornerRadius. The selector somewhat obscured, which usually means it will get past app review. However, use at your own risk!

Why didn't you hardcode the values instead?

I didn't want to use model identifiers (i.e., iPhone10,2) and miss an international variant, or have to update it when new devices launch.

It's also tricky to use screen resolutions, as multiple devices share the same resolution and scale with different corner radii. Display Zoom messes with this too, and ultimately it just seems like a bad idea to assume anything about the device based on the display resolution.

How to use

iOS device displays use a continious corner curve, which means the corners are not true circles. In iOS 13+ you can use CALayer.cornerCurve to specify a continuous corner curve. You might create a view subclass like this:

class DisplayCornerMatchingView: UIView {
    override init(frame: CGRect) {
        super.init(frame: frame)
        layer.cornerCurve = .continuous
        layer.cornerRadius = UIScreen.main.displayCornerRadius

Or perhaps you want to animate from a different corner radius to the screen one. Either way, be sure to set layer.cornerCurve = .continuous on the view.

Values reported

On iOS 14.1, the follow values were reported for each device with rounded corners:

Device Value (pts)
iPhone X / Xs / Xs Max / 11 Pro / 11 Pro Max 39.0
iPhone Xr / 11 41.5
iPhone 12 mini 44.0
iPhone 12 / 12 Pro 47.33
iPhone 12 Pro Max 53.33
iPad Air / iPad Pro 11-inch / 12.9-inch 18.0


Stars: 74
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API