Skip to content

Commit 472e8f5

Browse files
authored
Merge pull request #288 from escfrya/support-watchos
watchOS support
2 parents ec9f3af + fa40c35 commit 472e8f5

File tree

9 files changed

+238
-6
lines changed

9 files changed

+238
-6
lines changed

Cache.podspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ Pod::Spec.new do |s|
1111
s.ios.deployment_target = '11.0'
1212
s.osx.deployment_target = '10.12'
1313
s.tvos.deployment_target = '11.0'
14+
s.watchos.deployment_target = '5.0'
1415

1516
s.requires_arc = true
1617
s.ios.source_files = 'Source/{iOS,Shared}/**/*'
1718
s.osx.source_files = 'Source/{Mac,Shared}/**/*'
1819
s.tvos.source_files = 'Source/{iOS,Shared}/**/*'
20+
s.watchos.source_files = 'Source/{iOS,Shared}/**/*'
1921
s.resources = 'Source/PrivacyInfo.xcprivacy'
2022

2123
s.frameworks = 'Foundation'

Cache.xcodeproj/project.pbxproj

Lines changed: 208 additions & 0 deletions
Large diffs are not rendered by default.

Source/Shared/Configuration/DiskConfig.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public struct DiskConfig {
1010
public let maxSize: UInt
1111
/// A folder to store the disk cache contents. Defaults to a prefixed directory in Caches if nil
1212
public let directory: URL?
13-
#if os(iOS) || os(tvOS)
13+
#if os(iOS) || os(tvOS) || os(watchOS)
1414
/// Data protection is used to store files in an encrypted format on disk and to decrypt them on demand.
1515
/// Support only on iOS and tvOS.
1616
public let protectionType: FileProtectionType?

Source/Shared/Library/ImageWrapper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
#if os(iOS) || os(tvOS) || os(macOS)
3+
#if os(iOS) || os(tvOS) || os(macOS) || os(watchOS)
44
public struct ImageWrapper: Codable {
55
public let image: Image
66

Source/Shared/Library/TransformerFactory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class TransformerFactory {
99
return Transformer<Data>(toData: toData, fromData: fromData)
1010
}
1111

12-
#if os(iOS) || os(tvOS) || os(macOS) || os(visionOS)
12+
#if os(iOS) || os(tvOS) || os(macOS) || os(watchOS) || os(visionOS)
1313
public static func forImage() -> Transformer<Image> {
1414
let toData: (Image) throws -> Data = { image in
1515
return try image.cache_toData().unwrapOrThrow(error: StorageError.transformerFail)

Source/Shared/Library/Types.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if os(iOS) || os(tvOS) || os(visionOS)
1+
#if os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
22
import UIKit
33
public typealias Image = UIImage
44
#elseif os(watchOS)

Source/Shared/Storage/DiskStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ final public class DiskStorage<Key: Hashable, Value> {
4040
try createDirectory()
4141

4242
// protection
43-
#if os(iOS) || os(tvOS)
43+
#if os(iOS) || os(tvOS) || os(watchOS)
4444
if let protectionType = config.protectionType {
4545
try setDirectoryAttributes([
4646
FileAttributeKey.protectionKey: protectionType

Source/Shared/Storage/Storage+Transform.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public extension Storage {
77
}
88

99

10-
#if os(iOS) || os(tvOS) || os(macOS)
10+
#if os(iOS) || os(tvOS) || os(macOS) || os(watchOS)
1111
func transformImage() -> Storage<Key, Image> {
1212
let storage = transform(transformer: TransformerFactory.forImage())
1313
return storage

SupportFiles/watchOS/Info.plist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>FMWK</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>$(CURRENT_PROJECT_VERSION)</string>
21+
</dict>
22+
</plist>

0 commit comments

Comments
 (0)