Skip to content
Draft
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
6 changes: 5 additions & 1 deletion Source/Device.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ extension Device {
}
#endif

#if os(iOS)
#if os(iOS) || os(tvOS)
// MARK: DiskSpace
extension Device {

Expand All @@ -2118,7 +2118,11 @@ 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, *)
public static var volumeAvailableCapacityForImportantUsage: Int64? {
Expand Down
6 changes: 5 additions & 1 deletion Source/Device.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ extension Device {
}
#endif

#if os(iOS)
#if os(iOS) || os(tvOS)
// MARK: DiskSpace
extension Device {

Expand All @@ -1259,7 +1259,11 @@ 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, *)
public static var volumeAvailableCapacityForImportantUsage: Int64? {
Expand Down
8 changes: 6 additions & 2 deletions Tests/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -584,17 +584,20 @@ class DeviceKitTests: XCTestCase {
}
}

#if os(iOS) || os(tvOS)
// MARK: - volumes
@available(iOS 11.0, *)
@available(iOS 11.0, tvOS 11.0, *)
func testVolumeTotalCapacity() {
XCTAssertNotNil(Device.volumeTotalCapacity)
}

@available(iOS 11.0, *)
@available(iOS 11.0, tvOS 11.0, *)
func testVolumeAvailableCapacity() {
XCTAssertNotNil(Device.volumeAvailableCapacity)
}
#endif

#if os(iOS)
@available(iOS 11.0, *)
func testVolumeAvailableCapacityForImportantUsage() {
XCTAssertNotNil(Device.volumeAvailableCapacityForImportantUsage)
Expand All @@ -609,6 +612,7 @@ class DeviceKitTests: XCTestCase {
func testVolumes() {
XCTAssertNotNil(Device.volumes)
}
#endif

func testCameras() {
for device in Device.allDevicesWithCamera {
Expand Down