Skip to content

Add iPhone Duo support and fix simulator detection - #507

Open
Zandor300 wants to merge 10 commits into
masterfrom
t3code/add-new-apple-device-support
Open

Zandor300 wants to merge 10 commits into
masterfrom
t3code/add-new-apple-device-support

Conversation

@Zandor300

@Zandor300 Zandor300 commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Add Device.iPhoneDuo support for iPhone19,4, with the A20 Pro chip and isFoldable. Fill in Touch ID, wide and ultra-wide cameras, rounded display corners, Dynamic Island, wireless charging, USB-C, 5G, eSIM, and dual eSIM from Apple’s specifications. Include an official Apple device image. Apple Pencil support is limited to the USB-C model (.firstGenerationUsbC).

Display metrics describe the outer display: 5.4 inches, a 233:339 aspect ratio (1398 × 2034 pixels), and 460 PPI. Sensor housing also describes the outer display, based on its visible camera cutout in Apple’s artwork; the deprecated X-Series list stays consistent with the sensor-housing list. Face ID, LiDAR, 3D Touch, and a dedicated telephoto camera remain unsupported. The 2× telephoto mode uses a crop of the main camera. The former placeholder:iPhoneDuo identifier returns .unknown.

Fix isSimulator for unknown models by checking the .simulator enum case instead of membership in allSimulators. With the 5.9.0 source and SIMULATOR_MODEL_IDENTIFIER=iPhone19,4, Device.current is Simulator (iPhone19,4) but previously returned false from isSimulator. Simulator detection now works even before a model is added to DeviceKit.

Validation:

  • Duo coverage checks outer-display metrics, supported and unsupported capabilities, physical camera types, and the generated device lists. Display and feature checks include the simulator representation.
  • Reproduced the released-code failure in an iOS 26.2 simulator by supplying the Duo model identifier. Xcode 26.2 has no native Duo simulator profile.
  • Added regression coverage for all known models, unknown models, and Device.current with Duo and unknown simulator identifiers. The unknown-model assertions failed before the fix and pass after it.
  • Full iOS (38 tests) and macOS (6) suites passed after completing the Duo metadata. tvOS (11) and watchOS (7) suites passed for the earlier simulator fix.
  • Generated-source reproducibility and git diff --check passed.
  • SwiftLint still reports the pre-existing mapToDevice complexity error (146).

The changelog groups these changes under version 5.10.0, with an empty Unreleased section above it.

Fixes #518

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
8 Warnings
⚠️ Source/Device.generated.swift#L588 - Function should have complexity 10 or less: currently complexity equals 146
cyclomatic_complexity Device.generated.swift:588
⚠️ Source/Device.generated.swift#L745 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:745
⚠️ Source/Device.generated.swift#L1390 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:1390
⚠️ Source/Device.generated.swift#L1670 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:1670
⚠️ Source/Device.generated.swift#L1861 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:1861
⚠️ Source/Device.generated.swift#L2032 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:2032
⚠️ Source/Device.generated.swift#L2765 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:2765
⚠️ Source/Device.generated.swift#L2829 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:2829

SwiftLint found issues

Warnings

File Line Reason
Tests.swift 80 Types should be nested at most 1 level deep (nesting)
Device.generated.swift 745 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 1390 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 1670 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 1861 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 2032 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 2765 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 2829 TODOs should be resolved (Replace with proper implementa...). (todo)

Errors

File Line Reason
Device.generated.swift 588 Function should have complexity 10 or less: currently complexity equals 146 (cyclomatic_complexity)

Generated by 🚫 Danger

@Zandor300
Zandor300 force-pushed the t3code/add-new-apple-device-support branch 2 times, most recently from b01a580 to fe2c427 Compare September 10, 2026 08:13
@mlbonniec

Copy link
Copy Markdown

Hi, any news on this PR ?

@beforeold

Copy link
Copy Markdown

Grabbed the identifiers off the simulators, in case that helps with the placeholders:

Device Identifier Runtime
iPhone 18 Pro iPhone19,2 iOS 27.0 (24A434)
iPhone 18 Pro Max iPhone19,3 iOS 27.0 (24A434)
iPhone Duo iPhone19,4 iOS 27.1 beta (24A94401)

(xcrun simctl getenv <udid> SIMULATOR_MODEL_IDENTIFIER, Xcode 26.4)

Since mapToDevice reads SIMULATOR_MODEL_IDENTIFIER for simulators, those are the exact strings it gets. Right now a Duo sim lands in .unknown("iPhone19,4").

Display specs off Apple's page:

Screen Diagonal Resolution ppi
Outer 5.4" 1398 x 2034 460
Inner 7.6" 1878 x 2670 430

Ratios come out to 233:339 and 313:445.

One gotcha if you read these from the simulator instead: it reports the inner screen as {2007, 2853} @3x, but that's the render buffer, downsampled to the 1878x2670 panel. Same as the 6/7/8 Plus, where DeviceKit uses 5.5"/401ppi rather than the 2208x1242 buffer. Outer screen is fine, the sim matches the specs there.

The two screens have different ppi though (460 vs 430), and there's only one ppi/diagonal/ratio per device. Not sure which way you'd want to go there - inner, outer, or new fields.

@0x1306a94

0x1306a94 commented Sep 20, 2026 •

Copy link
Copy Markdown
Device Identifier
iPhone 18 Pro iPhone19,2 https://theapplewiki.com/wiki/IPhone_18_Pro
iPhone 18 Pro Max (Qualcomm baseband) iPhone19,3 https://theapplewiki.com/wiki/IPhone_18_Pro_Max
iPhone 18 Pro Max iPhone19,7 https://theapplewiki.com/wiki/IPhone_18_Pro_Max
iPhone Duo iPhone19,4 https://theapplewiki.com/wiki/IPhone_Duo

@Anywhere-Music-Player

Copy link
Copy Markdown

@EugenKuzn @Zandor300 could you please review and merge this? We urgently need the new device support. Thanks!

@Anywhere-Music-Player

Copy link
Copy Markdown

@EugenKuzn thanks for the quick review! Could you also publish a new release as soon as this is merged so we can use it right away? 🙏

Zandor300 added a commit that referenced this pull request Sep 21, 2026
Adapt PR #507, excluding iPhone Duo and the foldability API. Replace provisional identifiers with researched hardware mappings, including both iPhone 18 Pro Max regional variants. Add Apple technical specification links, display metrics, and device mapping regression coverage.

Adapted from commit fe2c427.
Zandor300 added a commit that referenced this pull request Sep 22, 2026
…#512)

* Add iPhone 18 Pro and Apple Watch Series 12 and Ultra 4 support

Adapt PR #507, excluding iPhone Duo and the foldability API. Replace provisional identifiers with researched hardware mappings, including both iPhone 18 Pro Max regional variants. Add Apple technical specification links, display metrics, and device mapping regression coverage.

Adapted from commit fe2c427.

* Consolidate new device changelog entry and list case values
@Zandor300
Zandor300 force-pushed the t3code/add-new-apple-device-support branch from fe2c427 to 2ab8367 Compare September 22, 2026 17:40
@Zandor300 Zandor300 changed the title Add provisional iPhone 18, iPhone Duo, and 2026 Apple Watch support Add provisional iPhone Duo support Sep 22, 2026
@Zandor300
Zandor300 force-pushed the t3code/add-new-apple-device-support branch from c9f43f7 to cd5fb71 Compare September 22, 2026 17:55
@Anywhere-Music-Player

Copy link
Copy Markdown

@Zandor300 @EugenKuzn could you please complete the required review, merge iPhone Duo detection, and publish a new tagged release that includes it?

DeviceKit 5.9.0 still maps iPhone19,4 to .unknown, so apps using stable SwiftPM releases cannot identify the model correctly. Apple has announced availability beginning October 23; having a release before then would let us ship support in time.

The current CI checks are green, but GitHub still shows REVIEW_REQUIRED. Could you clarify what remains to be addressed before this can merge?

If the two-display API discussion is holding this up, could basic identifier/name recognition ship first, with unverified display metrics left explicitly unknown as in this PR? We need reliable model detection even while the broader display API is being worked out.

Thanks for maintaining DeviceKit!

@lewis-smith

Copy link
Copy Markdown

It would be valuable to have this released.
Currently Device.current.isSimulator returns false for iPhone Duo in the simulator.

@CtrlJone

Copy link
Copy Markdown

Thank you so much for such an excellent library! Could you please let me know when the next version will be released?
@Zandor300

@Juanledesmaa

Copy link
Copy Markdown

First of all, thanks for this amazing library. Do you have any timeline on when this will be available? Thanks in advance 🙏

@CtrlJone

Copy link
Copy Markdown

Thank you so much for such an excellent library! Could you please let me know when the next version will be released?
@mlbonniec @Zandor300

@0xpablo

0xpablo commented Oct 26, 2026

Copy link
Copy Markdown

Hi there, I think there's something missing. The Duo supports the Apple Pencil but I can't see the device included in the applePencilSupport enum.

Thanks!

cc: @Zandor300 @EugenKuzn

@Zandor300 Zandor300 changed the title Add provisional iPhone Duo support Add iPhone Duo support and fix simulator detection Oct 27, 2026
Comment thread Tests/Tests.swift

#if os(iOS) || os(watchOS)
func testSeptember2026Devices() {
struct ExpectedDevice {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Types should be nested at most 1 level deep
nesting Tests.swift:80

@SentoCrespo

Copy link
Copy Markdown

+1 to iPhone Duo support please. Thanks!

@CtrlJone

CtrlJone commented Oct 28, 2026 •

Copy link
Copy Markdown

Hello,Will it be released today? @Zandor300

@CtrlJone

CtrlJone commented Oct 29, 2026 •

Copy link
Copy Markdown

We are currently working on porting to the Duo device, but since this library has not yet been released, it is hindering our progress. Thank you for creating such an excellent library—would it be possible to release a new version soon?
@Zandor300 @kudit @furiosFast @mlbonniec @dennisweissmann

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for iPhone Duo