Skip to content

Commit 20f0472

Browse files
Philipp HomannPhilipp Homann
authored andcommitted
removed possibility to define cache size for mac catalyst (currently not supported)
1 parent a66aed7 commit 20f0472

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Sources/UsefulNetworkLayer/NetworkLayer/NetworkLayer+Cache.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ extension NetworkLayer {
3636
self.initialize()
3737
}
3838

39-
39+
// not for Mac Catalyst
40+
// "The new required URLCache initializer init(memoryCapacity:diskCapacity:diskPath:) is currently unimplemented. (50739637)" from Known Issues in https://developer.apple.com/documentation/macos_release_notes/macos_10_15_beta_release_notes
41+
#if !targetEnvironment(macCatalyst)
4042
/**
4143
Initialize cache with the specified capacity preferences and path.
4244
- parameter memoryCapacity: The RAM demand. Set `0` if you don't want to use temporary memory
4345
- parameter diskCapacity: The storage demand. Set `0` if you don't want to save cache indefinitely
4446
- parameter diskPath: The path for the custom location in the storage to save
4547
*/
46-
#if !os(macOS)
4748
override init(memoryCapacity: Int, diskCapacity: Int, diskPath path: String?) {
4849
super.init(memoryCapacity: memoryCapacity, diskCapacity: diskCapacity, diskPath: path)
4950
self.initialize()

Sources/UsefulNetworkLayer/NetworkLayer/NetworkLayer.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,15 @@ public class NetworkLayer: NSObject, URLSessionDataDelegate {
7676
/// Holds cache of the `NetworkLayer`.
7777
public var _cache: Cache? {
7878
get {
79+
// not for Mac Catalyst
80+
// "The new required URLCache initializer init(memoryCapacity:diskCapacity:diskPath:) is currently unimplemented. (50739637)" from Known Issues in https://developer.apple.com/documentation/macos_release_notes/macos_10_15_beta_release_notes
81+
#if !targetEnvironment(macCatalyst)
7982
return NetworkLayer.Cache(memoryCapacity: 0,
8083
diskCapacity: 150 * 1024 * 1024,
8184
diskPath: nil)
85+
#else
86+
return NetworkLayer.Cache()
87+
#endif
8288
}
8389
}
8490

0 commit comments

Comments
 (0)