Skip to content

Commit

Permalink
removed possibility to define cache size for mac catalyst (currently …
Browse files Browse the repository at this point in the history
…not supported)
  • Loading branch information
Philipp Homann authored and Philipp Homann committed Jan 14, 2021
1 parent a66aed7 commit 20f0472
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ extension NetworkLayer {
self.initialize()
}


// not for Mac Catalyst
// "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
#if !targetEnvironment(macCatalyst)
/**
Initialize cache with the specified capacity preferences and path.
- parameter memoryCapacity: The RAM demand. Set `0` if you don't want to use temporary memory
- parameter diskCapacity: The storage demand. Set `0` if you don't want to save cache indefinitely
- parameter diskPath: The path for the custom location in the storage to save
*/
#if !os(macOS)
override init(memoryCapacity: Int, diskCapacity: Int, diskPath path: String?) {
super.init(memoryCapacity: memoryCapacity, diskCapacity: diskCapacity, diskPath: path)
self.initialize()
Expand Down
6 changes: 6 additions & 0 deletions Sources/UsefulNetworkLayer/NetworkLayer/NetworkLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,15 @@ public class NetworkLayer: NSObject, URLSessionDataDelegate {
/// Holds cache of the `NetworkLayer`.
public var _cache: Cache? {
get {
// not for Mac Catalyst
// "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
#if !targetEnvironment(macCatalyst)
return NetworkLayer.Cache(memoryCapacity: 0,
diskCapacity: 150 * 1024 * 1024,
diskPath: nil)
#else
return NetworkLayer.Cache()
#endif
}
}

Expand Down

0 comments on commit 20f0472

Please sign in to comment.