Skip to content

Add tvOS support for volume capacity properties - #455

Draft
Zandor300 with Copilot wants to merge 4 commits into
masterfrom
copilot/fix-449
Draft

Add tvOS support for volume capacity properties#455
Zandor300 with Copilot wants to merge 4 commits into
masterfrom
copilot/fix-449

Conversation

CopilotAI commented Sep 11, 2025

Copy link
Copy Markdown
Contributor
  • Analyze tvOS support requirements for volume capacity properties
  • Update conditional compilation directives from #if os(iOS) to #if os(iOS) || os(tvOS) for basic volume properties
  • Keep advanced volume properties iOS-only (volumeAvailableCapacityForImportantUsage, volumeAvailableCapacityForOpportunisticUsage, volumes)
  • Update tests to match platform availability
  • Regenerate Device.generated.swift without sourceLocation debug lines
  • Fix tvOS build failures by restricting unavailable APIs to iOS

Changes made:

  • Split volume capacity implementation into two sections:
    • Basic properties (volumeTotalCapacity, volumeAvailableCapacity): Available on iOS and tvOS
    • Advanced properties (volumeAvailableCapacityForImportantUsage, volumeAvailableCapacityForOpportunisticUsage, volumes): iOS-only
  • Updated tests to reflect platform-specific availability
  • Advanced volume APIs use iOS-only resource keys that are not available on tvOS

Technical details:

  • volumeAvailableCapacityForImportantUsageKey and volumeAvailableCapacityForOpportunisticUsageKey are unavailable in tvOS
  • URLResourceValues does not expose the corresponding properties on tvOS
  • Basic volume capacity APIs work on both platforms as they use standard resource keys

Fixes#449.


💡 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.

Co-authored-by: Zandor300 <6069593+Zandor300@users.noreply.github.com>
CopilotAI changed the title [WIP] Volume capacity values properties not generated for tvOSAdd tvOS support for volume capacity propertiesSep 11, 2025
CopilotAI requested a review from Zandor300September 11, 2025 22:29
@Zandor300

Copy link
Copy Markdown
Member

@copilot Run gyb with flag " --line-directive '' to get rid of the "sourceLocation" lines in the generated swift file. Update your own instructions to include that by default.

…e-directive flag
Co-authored-by: Zandor300 <6069593+Zandor300@users.noreply.github.com>

CopilotAI commented Sep 11, 2025

Copy link
Copy Markdown
ContributorAuthor

@copilot Run gyb with flag " --line-directive '' to get rid of the "sourceLocation" lines in the generated swift file. Update your own instructions to include that by default.

Updated the generated Swift file to remove sourceLocation lines using python3 Utils/gyb.py --line-directive '' Source/Device.swift.gyb > Source/Device.generated.swift. This removes all the // ###sourceLocation debugging lines for cleaner generated code. (f822d31)

@github-actions

github-actionsBot commented Sep 11, 2025

Copy link
Copy Markdown
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…).
todoDevice.generated.swift:742
⚠️Source/Device.generated.swift#L1319 - TODOs should be resolved (Replace with proper implementa…).
todoDevice.generated.swift:1319
⚠️Source/Device.generated.swift#L1583 - TODOs should be resolved (Replace with proper implementa…).
todoDevice.generated.swift:1583
⚠️Source/Device.generated.swift#L1761 - TODOs should be resolved (Replace with proper implementa…).
todoDevice.generated.swift:1761
⚠️Source/Device.generated.swift#L1919 - TODOs should be resolved (Replace with proper implementa…).
todoDevice.generated.swift:1919
⚠️Source/Device.generated.swift#L2623 - TODOs should be resolved (Replace with proper implementa…).
todoDevice.generated.swift:2623
⚠️Source/Device.generated.swift#L2684 - TODOs should be resolved (Replace with proper implementa…).
todoDevice.generated.swift:2684
⚠️Tests/Tests.swift#L463 - Collection literals should not have trailing commas.
trailing_commaTests.swift:463
⚠️Tests/Tests.swift#L496 - Collection literals should not have trailing commas.
trailing_commaTests.swift:496
⚠️Tests/Tests.swift#L531 - Collection literals should not have trailing commas.
trailing_commaTests.swift:531
⚠️Tests/Tests.swift#L538 - Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines
function_body_lengthTests.swift:538
⚠️Tests/Tests.swift#L580 - Collection literals should not have trailing commas.
trailing_commaTests.swift:580
⚠️Tests/Tests.swift#L670 - Collection literals should not have trailing commas.
trailing_commaTests.swift:670
⚠️Tests/Tests.swift#L711 - Collection literals should not have trailing commas.
trailing_commaTests.swift:711

SwiftLint found issues

Warnings

FileLineReason
Tests.swift538Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
Tests.swift463Collection literals should not have trailing commas. (trailing_comma)
Tests.swift496Collection literals should not have trailing commas. (trailing_comma)
Tests.swift531Collection literals should not have trailing commas. (trailing_comma)
Tests.swift580Collection literals should not have trailing commas. (trailing_comma)
Tests.swift670Collection literals should not have trailing commas. (trailing_comma)
Tests.swift711Collection literals should not have trailing commas. (trailing_comma)
Device.generated.swift742TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift1319TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift1583TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift1761TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift1919TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift2623TODOs should be resolved (Replace with proper implementa...). (todo)
Device.generated.swift2684TODOs should be resolved (Replace with proper implementa...). (todo)

Generated by 🚫 Danger

@Zandor300

Copy link
Copy Markdown
Member

@copilot

tvOS build failed:

Test session results, code coverage, and logs:
Value of type 'URLResourceValues' has no member 'volumeAvailableCapacityForImportantUsage'
/Users/runner/Library/Developer/Xcode/DerivedData/DeviceKit-cvoicodebiifnxebfzlbypqvhhkw/Logs/Test/Test-DeviceKit-2025.09.11_22-38-36-+0000.xcresult

Value of type 'URLResourceValues' has no member 'volumeAvailableCapacityForOpportunisticUsage'
'volumeAvailableCapacityForImportantUsageKey' is unavailable in tvOS
'volumeAvailableCapacityForOpportunisticUsageKey' is unavailable in tvOS
Testing cancelled because the build failed.

** TEST FAILED **

…properties for both iOS and tvOS
Co-authored-by: Zandor300 <6069593+Zandor300@users.noreply.github.com>

CopilotAI commented Oct 3, 2025

Copy link
Copy Markdown
ContributorAuthor

@copilot

tvOS build failed:
...

Fixed the tvOS build errors. The advanced volume capacity properties (volumeAvailableCapacityForImportantUsage, volumeAvailableCapacityForOpportunisticUsage, and volumes) use resource keys that are unavailable on tvOS, so I've restricted them to iOS-only. Basic volume properties (volumeTotalCapacity and volumeAvailableCapacity) remain available on both iOS and tvOS. (cab5466)

Sign up for freeto 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.

Volume capacity values properties not generated for tvOS

2 participants

@Zandor300