Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 17, 2025

Fix incorrect Apple Pencil compatibility for recent iPad models

Based on Apple's official documentation at https://support.apple.com/en-au/HT211029:

Changes Summary:

iPad (10th gen) & iPad (A16)

  • Before: Apple Pencil (USB-C) only
  • After: Apple Pencil (1st gen) + Apple Pencil (USB-C)

iPad Air 11" & 13" (M2)

  • Before: Apple Pencil (2nd gen) + Apple Pencil Pro
  • After: Apple Pencil (USB-C) + Apple Pencil Pro

iPad Air 11" & 13" (M3)

  • Before: Apple Pencil (2nd gen) + Apple Pencil Pro
  • After: Apple Pencil (USB-C) + Apple Pencil Pro

iPad Pro 11" & 13" (M4)

  • Before: Apple Pencil (2nd gen) + Apple Pencil (USB-C) + Apple Pencil Pro
  • After: Apple Pencil (USB-C) + Apple Pencil Pro

Technical Changes:

  • Add template support for value 13 (firstGeneration + firstGenerationUsbC combination)
  • Update iPad (10th gen) - Change applePencilSupport from 3 to 13
  • Update iPad (A16) - Change applePencilSupport from 3 to 13
  • Update iPad Air 11" (M2) - Change applePencilSupport from 24 to 34
  • Update iPad Air 13" (M2) - Change applePencilSupport from 24 to 34
  • Update iPad Air 11" (M3) - Change applePencilSupport from 24 to 34
  • Update iPad Air 13" (M3) - Change applePencilSupport from 24 to 34
  • Update iPad Pro 11" (M4) - Change applePencilSupport from 234 to 34
  • Update iPad Pro 13" (M4) - Change applePencilSupport from 234 to 34
  • Regenerate Device.generated.swift from template
  • Add comprehensive tests for all affected devices
  • Remove sourceLocation debug lines from generated file
  • Run code review (no changes detected, all committed)
  • Run security scan (no issues found)

Files Changed:

  • Source/Device.swift.gyb - Updated device definitions and added template case for value 13
  • Source/Device.generated.swift - Regenerated from template without sourceLocation lines (1235 debug lines removed)
  • Tests/Tests.swift - Added 50 lines of tests validating all changes

Note: This project requires macOS with Xcode to build and test. The CI pipeline will validate these changes on macOS.

Original prompt

This section details on the original issue you should resolve

<issue_title>Incorrect Apple Pencil compatibility for M4 iPad Pro and M2/M3 iPad Air models</issue_title>
<issue_description>Device.applePencilSupport currently lists incorrect Apple Pencil compatibility for several recent iPad models.
Apple’s official documentation: https://support.apple.com/en-au/HT211029

  • M4 iPad Pro (11/13") – Does not support Apple Pencil (2nd gen). Supports Pencil Pro and Pencil (USB-C).
  • iPad Air (M2/M3, 11" & 13") – Supports Pencil Pro and Pencil (USB-C), not 2nd gen.
  • iPad (10th gen) & iPad (A16) – Supports Pencil (USB-C) and Pencil (1st gen).

Proposed fix:

case .iPadPro11M4, .iPadPro13M4:
    return [.firstGenerationUsbC, .pro]

case .iPadAir11M2, .iPadAir13M2, .iPadAir11M3, .iPadAir13M3:
    return [.firstGenerationUsbC, .pro]

case .iPad10, .iPadA16:
    return [.firstGenerationUsbC, .firstGeneration]
</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@github-actions
Copy link

github-actions bot commented Nov 17, 2025

15 Warnings
⚠️ Plist changed, don't forget to localize your plist values
⚠️ Source/Device.generated.swift#L742 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:742
⚠️ Source/Device.generated.swift#L1319 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:1319
⚠️ Source/Device.generated.swift#L1583 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:1583
⚠️ Source/Device.generated.swift#L1761 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:1761
⚠️ Source/Device.generated.swift#L1919 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:1919
⚠️ Source/Device.generated.swift#L2623 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:2623
⚠️ Source/Device.generated.swift#L2684 - TODOs should be resolved (Replace with proper implementa…).
todo Device.generated.swift:2684
⚠️ Tests/Tests.swift#L463 - Collection literals should not have trailing commas.
trailing_comma Tests.swift:463
⚠️ Tests/Tests.swift#L496 - Collection literals should not have trailing commas.
trailing_comma Tests.swift:496
⚠️ Tests/Tests.swift#L531 - Collection literals should not have trailing commas.
trailing_comma Tests.swift:531
⚠️ Tests/Tests.swift#L538 - Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines
function_body_length Tests.swift:538
⚠️ Tests/Tests.swift#L580 - Collection literals should not have trailing commas.
trailing_comma Tests.swift:580
⚠️ Tests/Tests.swift#L668 - Collection literals should not have trailing commas.
trailing_comma Tests.swift:668
⚠️ Tests/Tests.swift#L709 - Collection literals should not have trailing commas.
trailing_comma Tests.swift:709

SwiftLint found issues

Warnings

File Line Reason
Tests.swift 538 Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
Tests.swift 463 Collection literals should not have trailing commas. (trailing_comma)
Tests.swift 496 Collection literals should not have trailing commas. (trailing_comma)
Tests.swift 531 Collection literals should not have trailing commas. (trailing_comma)
Tests.swift 580 Collection literals should not have trailing commas. (trailing_comma)
Tests.swift 668 Collection literals should not have trailing commas. (trailing_comma)
Tests.swift 709 Collection literals should not have trailing commas. (trailing_comma)
Tests.swift 722 Lines should not have trailing whitespace. (trailing_whitespace)
Tests.swift 728 Lines should not have trailing whitespace. (trailing_whitespace)
Tests.swift 734 Lines should not have trailing whitespace. (trailing_whitespace)
Tests.swift 740 Lines should not have trailing whitespace. (trailing_whitespace)
Tests.swift 746 Lines should not have trailing whitespace. (trailing_whitespace)
Tests.swift 752 Lines should not have trailing whitespace. (trailing_whitespace)
Tests.swift 758 Lines should not have trailing whitespace. (trailing_whitespace)
Device.generated.swift 742 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 1319 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 1583 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 1761 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 1919 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 2623 TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift 2684 TODOs should be resolved (Replace with proper implementa...). (todo)

Generated by 🚫 Danger

@Zandor300
Copy link
Member

@copilot remove sourceLocation lines from generated Swift file.

Copilot AI changed the title [WIP] Fix incorrect Apple Pencil compatibility for iPad models Fix Apple Pencil compatibility for M4 iPad Pro and M2/M3 iPad Air models Nov 17, 2025
Copilot AI requested a review from Zandor300 November 17, 2025 21:27
Copilot finished work on behalf of Zandor300 November 17, 2025 21:27
Copy link
Contributor Author

Copilot AI commented Nov 17, 2025

@copilot remove sourceLocation lines from generated Swift file.

Done! Regenerated the file using gyb.py --line-directive '' to suppress the sourceLocation debug markers. All 1235 lines removed while preserving the Apple Pencil compatibility fixes. (774cb6c)

Copilot finished work on behalf of Zandor300 November 17, 2025 21:32
XCTAssertTrue(Device.iPad10.applePencilSupport.contains(.firstGenerationUsbC))
XCTAssertFalse(Device.iPad10.applePencilSupport.contains(.secondGeneration))
XCTAssertFalse(Device.iPad10.applePencilSupport.contains(.pro))

Choose a reason for hiding this comment

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

⚠️ Lines should not have trailing whitespace.
trailing_whitespace Tests.swift:722

XCTAssertTrue(Device.iPadA16.applePencilSupport.contains(.firstGenerationUsbC))
XCTAssertFalse(Device.iPadA16.applePencilSupport.contains(.secondGeneration))
XCTAssertFalse(Device.iPadA16.applePencilSupport.contains(.pro))

Choose a reason for hiding this comment

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

⚠️ Lines should not have trailing whitespace.
trailing_whitespace Tests.swift:728

XCTAssertTrue(Device.iPadAir11M2.applePencilSupport.contains(.firstGenerationUsbC))
XCTAssertFalse(Device.iPadAir11M2.applePencilSupport.contains(.secondGeneration))
XCTAssertTrue(Device.iPadAir11M2.applePencilSupport.contains(.pro))

Choose a reason for hiding this comment

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

⚠️ Lines should not have trailing whitespace.
trailing_whitespace Tests.swift:734

XCTAssertTrue(Device.iPadAir13M2.applePencilSupport.contains(.firstGenerationUsbC))
XCTAssertFalse(Device.iPadAir13M2.applePencilSupport.contains(.secondGeneration))
XCTAssertTrue(Device.iPadAir13M2.applePencilSupport.contains(.pro))

Choose a reason for hiding this comment

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

⚠️ Lines should not have trailing whitespace.
trailing_whitespace Tests.swift:740

XCTAssertTrue(Device.iPadAir11M3.applePencilSupport.contains(.firstGenerationUsbC))
XCTAssertFalse(Device.iPadAir11M3.applePencilSupport.contains(.secondGeneration))
XCTAssertTrue(Device.iPadAir11M3.applePencilSupport.contains(.pro))

Choose a reason for hiding this comment

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

⚠️ Lines should not have trailing whitespace.
trailing_whitespace Tests.swift:746

XCTAssertTrue(Device.iPadAir13M3.applePencilSupport.contains(.firstGenerationUsbC))
XCTAssertFalse(Device.iPadAir13M3.applePencilSupport.contains(.secondGeneration))
XCTAssertTrue(Device.iPadAir13M3.applePencilSupport.contains(.pro))

Choose a reason for hiding this comment

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

⚠️ Lines should not have trailing whitespace.
trailing_whitespace Tests.swift:752

XCTAssertTrue(Device.iPadPro11M4.applePencilSupport.contains(.firstGenerationUsbC))
XCTAssertFalse(Device.iPadPro11M4.applePencilSupport.contains(.secondGeneration))
XCTAssertTrue(Device.iPadPro11M4.applePencilSupport.contains(.pro))

Choose a reason for hiding this comment

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

⚠️ Lines should not have trailing whitespace.
trailing_whitespace Tests.swift:758

@Zandor300 Zandor300 requested review from Copilot and removed request for Zandor300 December 2, 2025 06:18
Copilot finished reviewing on behalf of Zandor300 December 2, 2025 06:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes incorrect Apple Pencil compatibility information for recent iPad models by updating the applePencilSupport property to match Apple's official documentation. The changes correct compatibility for M4 iPad Pro, M2/M3 iPad Air, and 10th generation iPad models.

Key changes:

  • Added template support for the value 13 combination (1st gen + USB-C Pencil) in the code generation template
  • Updated 8 iPad models with corrected Apple Pencil support values
  • Added comprehensive test coverage for all affected devices

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
Source/Device.swift.gyb Updated applePencilSupport values for 8 iPad models (iPad 10th gen, iPad A16, 4 iPad Air models, 2 iPad Pro M4 models) and added template case for value 13
Source/Device.generated.swift Regenerated Swift code from template with corrected Apple Pencil support arrays for all affected devices
Tests/Tests.swift Added testApplePencilSupport() function with 50 lines of assertions validating correct Pencil support for all 8 affected iPad models

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.

Incorrect Apple Pencil compatibility for M4 iPad Pro and M2/M3 iPad Air models

2 participants