Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 2021 & 2022 devices #30

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
# IRLSize Change Log

## [2.4.0](https://github.com/detroit-labs/IRLSize/releases/tag/2.2.4)

**Released:** 2023-01-11

### Added

- Support for iPhone 13
- Support for iPhone 13 mini
- Support for iPhone 13 Pro
- Support for iPhone 13 Pro Max
- Support for iPhone 14
- Support for iPhone 14 Plus
- Support for iPhone 14 Pro
- Support for iPhone 14 Pro Max
- Support for iPad Pro (12.9-inch) (5th Generation)
- Support for iPad Pro (11-inch) (3nd Generation)
- Support for iPad (9th Generation)
- Support for iPad mini (6th Generation)

## [2.3.0](https://github.com/detroit-labs/IRLSize/releases/tag/2.3.0)

**Released:** 2020-10-19

### Added

- Support for iPhone 12
- Support for iPhone 12 mini
- Support for iPhone 12 Pro
Expand All @@ -14,86 +35,109 @@
- Support for Apple Watch SE

### Updated

- iOS deployment target set to 9.0 to match Xcode 12’s support.

## [2.2.5](https://github.com/detroit-labs/IRLSize/releases/tag/2.2.5)

**Released:** 2020-08-28

### Updated

- Added `DEFINES_MODULE` setting to support static libraries.
- Note: You may need to set the `-Wno-incomplete-umbrella` compiler flag to
avoid a warning when using this setting. See
[this GitHub issue](https://github.com/CocoaPods/CocoaPods/issues/7729)
for more information.

## [2.2.4](https://github.com/detroit-labs/IRLSize/releases/tag/2.2.4)

**Released:** 2020-04-15

### Added

- Support for iPad Pro (12.9-inch) (4th Generation).
- Support for iPad Pro (11-inch) (2nd Generation).
- Support for iPhone SE (2nd Generation).

## [2.2.3](https://github.com/detroit-labs/IRLSize/releases/tag/2.2.3)

**Released:** 2019-09-24

### Added

- Support for iPad (7th Generation).

## [2.2.2](https://github.com/detroit-labs/IRLSize/releases/tag/2.2.2)

**Released:** 2019-09-16

### Added

- Support for iPhone 11, iPhone 11 Pro, iPhone 11 Pro Max, and Apple Watch
Series 5.
- Preliminary support for the 10.2-inch iPad display size.

## [2.2.1](https://github.com/detroit-labs/IRLSize/releases/tag/2.2.1)

**Released:** 2019-05-29

### Added

- Support for iPod touch (7th generation).

## [2.2.0](https://github.com/detroit-labs/IRLSize/releases/tag/2.2.0)

**Released:** 2019-04-29

### Updated

- Switch from SDVersion to Orchard for device identification.

### Added

- Support for 2019 iPad models.

## [2.1.0](https://github.com/detroit-labs/IRLSize/releases/tag/2.1.0)

**Released:** 2018-11-16

### Updated

- Restored the deployment target to iOS 8.0 and watchOS 2.0.

## [2.0.1](https://github.com/detroit-labs/IRLSize/releases/tag/2.0.1)

**Released:** 2018-11-08

### Updated

- Improved accuracy of Apple Watch measurements.
- Improved the display of the example application, including supporting Dynamic
- Improved the display of the example application, including supporting Dynamic
Type.

### Added

- Support for 2018 iPad Pro models.
- Fixed a bug in estimating iPad Pro sizes.
- Added debug logging of estimates (define `IRLSIZE_DEBUG` to `1` to use).

## [2.0.0](https://github.com/detroit-labs/IRLSize/releases/tag/2.0.0)

**Released:** 2018-11-06

### Breaking Changes

- Renamed `IRLRawLengthMeasurement` to `IRLRawMillimeters`.
- All measurements are now in terms of millimeters.
- Updated deployment target to iOS 10.0 and watchOS 3.0.

### Updated

- Re-sourced all device size data from
[official Apple documentation](https://developer.apple.com/accessories).
- Refactored test suite to have much less repeated code.

### Fixed

- Fixed incorrect values for landscape devices.
4 changes: 2 additions & 2 deletions IRLSize.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "IRLSize"
s.version = "2.3.0"
s.version = "2.4.0"
s.summary = "A library for determining the actual physical size of pixels on an iOS or watchOS device."
s.description = <<-DESC
IRLSize is used to determine the physical size of the device
Expand Down Expand Up @@ -28,7 +28,7 @@ Pod::Spec.new do |s|
s.watchos.source_files = 'Pod/Classes/watchOS/*'
s.watchos.frameworks = 'WatchKit'

s.dependency 'Orchard/ObjC', '>= 1.8.0'
s.dependency 'Orchard/ObjC', '>= 1.13.0'

s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }

Expand Down
13 changes: 13 additions & 0 deletions IRLSizeTests/IRLSizeTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@
KNOWN_DEVICE_TEST("iPhone 12 mini", iPhone12Mini, 14.1)
KNOWN_DEVICE_TEST("iPhone 12 Pro", iPhone12Pro, 14.1)
KNOWN_DEVICE_TEST("iPhone 12 Pro Max", iPhone12ProMax, 14.1)
KNOWN_DEVICE_TEST("iPhone 13", iPhone13, 15.1)
KNOWN_DEVICE_TEST("iPhone 13 mini", iPhone13Mini, 15.1)
KNOWN_DEVICE_TEST("iPhone 13 Pro", iPhone13Pro, 15.1)
KNOWN_DEVICE_TEST("iPhone 13 Pro Max", iPhone13ProMax, 15.1)
KNOWN_DEVICE_TEST("iPhone 14", iPhone14, 16.1)
KNOWN_DEVICE_TEST("iPhone 14 Plus", iPhone14Plus, 16.1)
KNOWN_DEVICE_TEST("iPhone 14 Pro", iPhone14Pro, 16.1)
KNOWN_DEVICE_TEST("iPhone 14 Pro Max", iPhone14ProMax, 16.1)


KNOWN_DEVICE_TEST("iPad (4th Generation)", iPad4, 6.0)
KNOWN_DEVICE_TEST("iPad mini", iPadMini, 6.0)
Expand All @@ -116,6 +125,10 @@
KNOWN_DEVICE_TEST("iPad Pro (11\", 2nd Generation)", iPadPro11Inch2, 13.4)
KNOWN_DEVICE_TEST("iPad (8th Generation)", iPad8, 14.0)
KNOWN_DEVICE_TEST("iPad Air (4th Generation)", iPadAir4, 14.0)
KNOWN_DEVICE_TEST("iPad (9th Generation)", iPad9, 15.0)
KNOWN_DEVICE_TEST("iPad Pro (12.9\", 5th Generation)", iPadPro12_9Inch5, 15.0)
KNOWN_DEVICE_TEST("iPad Pro (11\", 3rd Generation)", iPadPro11Inch3, 15.0)
KNOWN_DEVICE_TEST("iPad mini (6th Generation)", iPadMini6, 15.0)

KNOWN_DEVICE_TEST("iPod touch (5th Generation)", iPodTouch5, 6.0)
KNOWN_DEVICE_TEST("iPod touch (6th Generation)", iPodTouch6, 8.4)
Expand Down
12 changes: 12 additions & 0 deletions Pod/Classes/iOS/UIDevice+IRLSize.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ - (IRLRawDimensions)irl_rawPhysicalScreenSize
IRLRawDimensions size = { 0.0f, 0.0f };

switch ([UIDevice.currentDevice orchardiOSDevice]) {
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone14ProMax)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone14Pro)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone14Plus)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone14)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone13ProMax)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone13Pro)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone13Mini)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone13)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone12ProMax)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone12Pro)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone12)
Expand All @@ -136,6 +144,10 @@ - (IRLRawDimensions)irl_rawPhysicalScreenSize
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone5c)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPhone5)

IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPadPro11Inch3)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPadPro12_9Inch5)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPad9)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPadMini6)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPadAir4)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPadPro12_9Inch4)
IRL_KNOWN_DEVICE_DIMENSIONS_MATCHING(OrchardiOSDevice, iPadPro11Inch2)
Expand Down
47 changes: 47 additions & 0 deletions Pod/Classes/iOS/iOSDeviceConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,38 @@ static const IRLRawMillimeters kiPhone12ProScreenWidth = 64.58;
static const IRLRawMillimeters kiPhone12ProMaxScreenHeight = 153.90;
static const IRLRawMillimeters kiPhone12ProMaxScreenWidth = 71.13;

// iPhone 13
static const IRLRawMillimeters kiPhone13ScreenHeight = kiPhone12ScreenHeight;
static const IRLRawMillimeters kiPhone13ScreenWidth = kiPhone12ScreenWidth;

// iPhone 13 mini
static const IRLRawMillimeters kiPhone13MiniScreenHeight = kiPhone12ProScreenHeight;
static const IRLRawMillimeters kiPhone13MiniScreenWidth = kiPhone12ProScreenWidth;

// iPhone 13 Pro
static const IRLRawMillimeters kiPhone13ProScreenHeight = kiPhone12ProScreenHeight;
static const IRLRawMillimeters kiPhone13ProScreenWidth = kiPhone12ProScreenWidth;

// iPhone 13 Pro Max
static const IRLRawMillimeters kiPhone13ProMaxScreenHeight = kiPhone12ProMaxScreenHeight;
static const IRLRawMillimeters kiPhone13ProMaxScreenWidth = kiPhone12ProMaxScreenWidth;

// iPhone 14
static const IRLRawMillimeters kiPhone14ScreenHeight = kiPhone12ScreenHeight;
static const IRLRawMillimeters kiPhone14ScreenWidth = kiPhone12ScreenWidth;

// iPhone 14 Plus
static const IRLRawMillimeters kiPhone14PlusScreenHeight = kiPhone12ProMaxScreenHeight;
static const IRLRawMillimeters kiPhone14PlusScreenWidth = kiPhone12ProMaxScreenWidth;

// iPhone 14 Pro
static const IRLRawMillimeters kiPhone14ProScreenHeight = 141.09;
static const IRLRawMillimeters kiPhone14ProScreenWidth = 65.08;

// iPhone 14 Pro Max
static const IRLRawMillimeters kiPhone14ProMaxScreenHeight = 154.34;
static const IRLRawMillimeters kiPhone14ProMaxScreenWidth = 71.21;


///////////
// iPads //
Expand All @@ -142,6 +174,10 @@ static const IRLRawMillimeters kiPad7ScreenWidth = 155.52;
static const IRLRawMillimeters kiPad8ScreenHeight = kiPad7ScreenHeight;
static const IRLRawMillimeters kiPad8ScreenWidth = kiPad7ScreenWidth;

// iPad (9th Generation)
static const IRLRawMillimeters kiPad9ScreenHeight = kiPad7ScreenHeight;
static const IRLRawMillimeters kiPad9ScreenWidth = kiPad7ScreenWidth;

// iPad mini
static const IRLRawMillimeters kiPadMiniScreenHeight = 161.2;
static const IRLRawMillimeters kiPadMiniScreenWidth = 121.3;
Expand All @@ -162,6 +198,10 @@ static const IRLRawMillimeters kiPadMini4ScreenWidth = 121.31;
static const IRLRawMillimeters kiPadMini5ScreenHeight = 160.74;
static const IRLRawMillimeters kiPadMini5ScreenWidth = 120.81;

// iPad mini (6th Generation)
static const IRLRawMillimeters kiPadMini6ScreenHeight = 177.75;
static const IRLRawMillimeters kiPadMini6ScreenWidth = 117.06;

// iPad Air
static const IRLRawMillimeters kiPadAirScreenHeight = 198.1;
static const IRLRawMillimeters kiPadAirScreenWidth = 149.0;
Expand Down Expand Up @@ -210,6 +250,13 @@ static const IRLRawMillimeters kiPadPro12_9Inch4ScreenWidth = 196.61;
static const IRLRawMillimeters kiPadPro11Inch2ScreenHeight = 230.25;
static const IRLRawMillimeters kiPadPro11Inch2ScreenWidth = 161.13;

// iPad Pro (12.9-inch) (5th Generation)
static const IRLRawMillimeters kiPadPro12_9Inch5ScreenHeight = kiPadPro12_9Inch4ScreenHeight;
static const IRLRawMillimeters kiPadPro12_9Inch5ScreenWidth = kiPadPro12_9Inch4ScreenWidth;

// iPad Pro (11-inch) (3rd Generation)
static const IRLRawMillimeters kiPadPro11Inch3ScreenHeight = kiPadPro11Inch2ScreenHeight;
static const IRLRawMillimeters kiPadPro11Inch3ScreenWidth = kiPadPro11Inch2ScreenWidth;

/////////////////
// iPods touch //
Expand Down