diff --git a/Source/Device.generated.swift b/Source/Device.generated.swift index 94b6c83..d8f3765 100644 --- a/Source/Device.generated.swift +++ b/Source/Device.generated.swift @@ -2118,21 +2118,25 @@ extension Device { public static var volumeAvailableCapacity: Int? { return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityKey]))?.volumeAvailableCapacity } +} +#endif +#if os(iOS) +extension Device { /// The volume’s available capacity in bytes for storing important resources. - @available(iOS 11.0, tvOS 11.0, *) + @available(iOS 11.0, *) public static var volumeAvailableCapacityForImportantUsage: Int64? { return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey]))?.volumeAvailableCapacityForImportantUsage } /// The volume’s available capacity in bytes for storing nonessential resources. - @available(iOS 11.0, tvOS 11.0, *) + @available(iOS 11.0, *) public static var volumeAvailableCapacityForOpportunisticUsage: Int64? { //swiftlint:disable:this identifier_name return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForOpportunisticUsageKey]))?.volumeAvailableCapacityForOpportunisticUsage } /// All volumes capacity information in bytes. - @available(iOS 11.0, tvOS 11.0, *) + @available(iOS 11.0, *) public static var volumes: [URLResourceKey: Int64]? { do { let values = try rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey, diff --git a/Source/Device.swift.gyb b/Source/Device.swift.gyb index db41807..dc0c654 100644 --- a/Source/Device.swift.gyb +++ b/Source/Device.swift.gyb @@ -1259,21 +1259,25 @@ extension Device { public static var volumeAvailableCapacity: Int? { return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityKey]))?.volumeAvailableCapacity } +} +#endif +#if os(iOS) +extension Device { /// The volume’s available capacity in bytes for storing important resources. - @available(iOS 11.0, tvOS 11.0, *) + @available(iOS 11.0, *) public static var volumeAvailableCapacityForImportantUsage: Int64? { return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey]))?.volumeAvailableCapacityForImportantUsage } /// The volume’s available capacity in bytes for storing nonessential resources. - @available(iOS 11.0, tvOS 11.0, *) + @available(iOS 11.0, *) public static var volumeAvailableCapacityForOpportunisticUsage: Int64? { //swiftlint:disable:this identifier_name return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForOpportunisticUsageKey]))?.volumeAvailableCapacityForOpportunisticUsage } /// All volumes capacity information in bytes. - @available(iOS 11.0, tvOS 11.0, *) + @available(iOS 11.0, *) public static var volumes: [URLResourceKey: Int64]? { do { let values = try rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey, diff --git a/Tests/Tests.swift b/Tests/Tests.swift index 3e4dc04..3cce097 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -595,18 +595,20 @@ class DeviceKitTests: XCTestCase { func testVolumeAvailableCapacity() { XCTAssertNotNil(Device.volumeAvailableCapacity) } + #endif - @available(iOS 11.0, tvOS 11.0, *) + #if os(iOS) + @available(iOS 11.0, *) func testVolumeAvailableCapacityForImportantUsage() { XCTAssertNotNil(Device.volumeAvailableCapacityForImportantUsage) } - @available(iOS 11.0, tvOS 11.0, *) + @available(iOS 11.0, *) func testVolumeAvailableCapacityForOpportunisticUsage() { XCTAssertNotNil(Device.volumeAvailableCapacityForOpportunisticUsage) } - @available(iOS 11.0, tvOS 11.0, *) + @available(iOS 11.0, *) func testVolumes() { XCTAssertNotNil(Device.volumes) }