Skip to content

Commit 11ef87c

Browse files
committed
Swift Async
1 parent 1aa840b commit 11ef87c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2002
-1949
lines changed

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cache.podspec

Lines changed: 0 additions & 22 deletions
This file was deleted.

Cache.xcodeproj/project.pbxproj

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
2292AB85252A14F50031F3B9 /* FileManager+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2292AB84252A14F50031F3B9 /* FileManager+Extensions.swift */; };
1818
2292AB86252A14F50031F3B9 /* FileManager+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2292AB84252A14F50031F3B9 /* FileManager+Extensions.swift */; };
1919
2292AB87252A14F50031F3B9 /* FileManager+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2292AB84252A14F50031F3B9 /* FileManager+Extensions.swift */; };
20+
A65F40E02901EA5C00B297C8 /* Sequence+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = A65F40DF2901EA5C00B297C8 /* Sequence+Async.swift */; };
21+
A65F40E12901EA5C00B297C8 /* Sequence+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = A65F40DF2901EA5C00B297C8 /* Sequence+Async.swift */; };
22+
A65F40E22901EA5C00B297C8 /* Sequence+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = A65F40DF2901EA5C00B297C8 /* Sequence+Async.swift */; };
2023
BDEDD37D1DBCEB8A007416A6 /* Cache.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BDEDD3561DBCE5B1007416A6 /* Cache.framework */; };
2124
D21B667C1F6A723C00125DE1 /* DataSerializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2CF98531F694FFA00CE8F68 /* DataSerializer.swift */; };
2225
D21B667E1F6A723C00125DE1 /* ExpirationMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2CF98551F694FFA00CE8F68 /* ExpirationMode.swift */; };
@@ -184,6 +187,7 @@
184187
0E79164D250E2B0400A71666 /* Hasher+constantAccrossExecutions+Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Hasher+constantAccrossExecutions+Tests.swift"; sourceTree = "<group>"; };
185188
2292AB7A252A14520031F3B9 /* URL+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+Extensions.swift"; sourceTree = "<group>"; };
186189
2292AB84252A14F50031F3B9 /* FileManager+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FileManager+Extensions.swift"; sourceTree = "<group>"; };
190+
A65F40DF2901EA5C00B297C8 /* Sequence+Async.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sequence+Async.swift"; sourceTree = "<group>"; };
187191
BDEDD3561DBCE5B1007416A6 /* Cache.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Cache.framework; sourceTree = BUILT_PRODUCTS_DIR; };
188192
BDEDD3781DBCEB8A007416A6 /* Cache-tvOS-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Cache-tvOS-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
189193
D221E5BB20D00D9300BC940E /* MemoryStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryStorage.swift; sourceTree = "<group>"; };
@@ -338,6 +342,7 @@
338342
D2CF98501F694FFA00CE8F68 /* Date+Extensions.swift */,
339343
2292AB7A252A14520031F3B9 /* URL+Extensions.swift */,
340344
2292AB84252A14F50031F3B9 /* FileManager+Extensions.swift */,
345+
A65F40DF2901EA5C00B297C8 /* Sequence+Async.swift */,
341346
);
342347
path = Extensions;
343348
sourceTree = "<group>";
@@ -368,12 +373,12 @@
368373
D2CF985A1F694FFA00CE8F68 /* Storage */ = {
369374
isa = PBXGroup;
370375
children = (
376+
D270147320D101F3003B45C7 /* StorageAware.swift */,
371377
D221E5BB20D00D9300BC940E /* MemoryStorage.swift */,
372378
D221E5C320D00DDB00BC940E /* DiskStorage.swift */,
373-
D270147320D101F3003B45C7 /* StorageAware.swift */,
374379
D270147720D1046A003B45C7 /* HybridStorage.swift */,
375-
D270147B20D107DA003B45C7 /* SyncStorage.swift */,
376380
D270147F20D10982003B45C7 /* CacheStorage.swift */,
381+
D270147B20D107DA003B45C7 /* SyncStorage.swift */,
377382
D270148320D10E76003B45C7 /* AsyncStorage.swift */,
378383
D270148720D11040003B45C7 /* Storage+Transform.swift */,
379384
D5A9D1C221144B65005DBD3F /* StorageObservationRegistry.swift */,
@@ -679,7 +684,7 @@
679684
isa = PBXProject;
680685
attributes = {
681686
LastSwiftUpdateCheck = 0800;
682-
LastUpgradeCheck = 1200;
687+
LastUpgradeCheck = 1400;
683688
ORGANIZATIONNAME = "Hyper Interaktiv AS";
684689
TargetAttributes = {
685690
BDEDD3551DBCE5B1007416A6 = {
@@ -790,6 +795,7 @@
790795
D270149220D1251E003B45C7 /* TypeWrapper.swift in Sources */,
791796
D2D4CC221FA3411300E4A2D5 /* JSONDictionaryWrapper.swift in Sources */,
792797
D2D4CC181FA3145000E4A2D5 /* MD5.swift in Sources */,
798+
A65F40E22901EA5C00B297C8 /* Sequence+Async.swift in Sources */,
793799
D221E5BE20D00D9300BC940E /* MemoryStorage.swift in Sources */,
794800
D270148E20D113EA003B45C7 /* Optional+Extension.swift in Sources */,
795801
D270147220D1018A003B45C7 /* Transformer.swift in Sources */,
@@ -879,6 +885,7 @@
879885
D270149120D1251E003B45C7 /* TypeWrapper.swift in Sources */,
880886
D2D4CC211FA3411300E4A2D5 /* JSONDictionaryWrapper.swift in Sources */,
881887
D2D4CC171FA3145000E4A2D5 /* MD5.swift in Sources */,
888+
A65F40E12901EA5C00B297C8 /* Sequence+Async.swift in Sources */,
882889
D221E5BD20D00D9300BC940E /* MemoryStorage.swift in Sources */,
883890
D270148D20D113EA003B45C7 /* Optional+Extension.swift in Sources */,
884891
D270147120D1018A003B45C7 /* Transformer.swift in Sources */,
@@ -934,6 +941,7 @@
934941
D270149020D1251E003B45C7 /* TypeWrapper.swift in Sources */,
935942
D2D4CC201FA3411300E4A2D5 /* JSONDictionaryWrapper.swift in Sources */,
936943
D2D4CC161FA3145000E4A2D5 /* MD5.swift in Sources */,
944+
A65F40E02901EA5C00B297C8 /* Sequence+Async.swift in Sources */,
937945
D221E5BC20D00D9300BC940E /* MemoryStorage.swift in Sources */,
938946
D270148C20D113EA003B45C7 /* Optional+Extension.swift in Sources */,
939947
D2CF98601F694FFA00CE8F68 /* DiskConfig.swift in Sources */,
@@ -1004,7 +1012,7 @@
10041012
SKIP_INSTALL = YES;
10051013
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
10061014
TARGETED_DEVICE_FAMILY = 3;
1007-
TVOS_DEPLOYMENT_TARGET = 11.0;
1015+
TVOS_DEPLOYMENT_TARGET = 16.0;
10081016
};
10091017
name = Debug;
10101018
};
@@ -1029,7 +1037,7 @@
10291037
SDKROOT = appletvos;
10301038
SKIP_INSTALL = YES;
10311039
TARGETED_DEVICE_FAMILY = 3;
1032-
TVOS_DEPLOYMENT_TARGET = 11.0;
1040+
TVOS_DEPLOYMENT_TARGET = 16.0;
10331041
};
10341042
name = Release;
10351043
};
@@ -1050,7 +1058,7 @@
10501058
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
10511059
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
10521060
TARGETED_DEVICE_FAMILY = 3;
1053-
TVOS_DEPLOYMENT_TARGET = 12.0;
1061+
TVOS_DEPLOYMENT_TARGET = 16.0;
10541062
};
10551063
name = Debug;
10561064
};
@@ -1069,7 +1077,7 @@
10691077
PRODUCT_NAME = "$(TARGET_NAME)";
10701078
SDKROOT = appletvos;
10711079
TARGETED_DEVICE_FAMILY = 3;
1072-
TVOS_DEPLOYMENT_TARGET = 12.0;
1080+
TVOS_DEPLOYMENT_TARGET = 16.0;
10731081
};
10741082
name = Release;
10751083
};
@@ -1079,6 +1087,7 @@
10791087
CLANG_ENABLE_MODULES = YES;
10801088
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
10811089
INFOPLIST_FILE = "$(SRCROOT)/Tests/iOS/Info.plist";
1090+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
10821091
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
10831092
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-iOS-Tests";
10841093
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1092,6 +1101,7 @@
10921101
CLANG_ENABLE_MODULES = YES;
10931102
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
10941103
INFOPLIST_FILE = "$(SRCROOT)/Tests/iOS/Info.plist";
1104+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
10951105
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
10961106
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-iOS-Tests";
10971107
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1103,6 +1113,7 @@
11031113
buildSettings = {
11041114
CODE_SIGN_IDENTITY = "";
11051115
COMBINE_HIDPI_IMAGES = YES;
1116+
DEAD_CODE_STRIPPING = YES;
11061117
DEFINES_MODULE = YES;
11071118
DYLIB_COMPATIBILITY_VERSION = 1;
11081119
DYLIB_CURRENT_VERSION = 1;
@@ -1112,7 +1123,7 @@
11121123
INFOPLIST_FILE = "$(SRCROOT)/SupportFiles/Mac/Info.plist";
11131124
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
11141125
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
1115-
MACOSX_DEPLOYMENT_TARGET = 10.12;
1126+
MACOSX_DEPLOYMENT_TARGET = 12.0;
11161127
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-Mac";
11171128
PRODUCT_NAME = Cache;
11181129
SDKROOT = macosx;
@@ -1125,6 +1136,7 @@
11251136
buildSettings = {
11261137
CODE_SIGN_IDENTITY = "";
11271138
COMBINE_HIDPI_IMAGES = YES;
1139+
DEAD_CODE_STRIPPING = YES;
11281140
DEFINES_MODULE = YES;
11291141
DYLIB_COMPATIBILITY_VERSION = 1;
11301142
DYLIB_CURRENT_VERSION = 1;
@@ -1134,7 +1146,7 @@
11341146
INFOPLIST_FILE = "$(SRCROOT)/SupportFiles/Mac/Info.plist";
11351147
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
11361148
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
1137-
MACOSX_DEPLOYMENT_TARGET = 10.12;
1149+
MACOSX_DEPLOYMENT_TARGET = 12.0;
11381150
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-Mac";
11391151
PRODUCT_NAME = Cache;
11401152
SDKROOT = macosx;
@@ -1147,10 +1159,11 @@
11471159
buildSettings = {
11481160
CODE_SIGN_IDENTITY = "-";
11491161
COMBINE_HIDPI_IMAGES = YES;
1162+
DEAD_CODE_STRIPPING = YES;
11501163
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
11511164
INFOPLIST_FILE = "$(SRCROOT)/Tests/Mac/Info.plist";
11521165
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
1153-
MACOSX_DEPLOYMENT_TARGET = 10.15;
1166+
MACOSX_DEPLOYMENT_TARGET = 12.0;
11541167
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-MacTests";
11551168
PRODUCT_NAME = "$(TARGET_NAME)";
11561169
SDKROOT = macosx;
@@ -1162,10 +1175,11 @@
11621175
buildSettings = {
11631176
CODE_SIGN_IDENTITY = "-";
11641177
COMBINE_HIDPI_IMAGES = YES;
1178+
DEAD_CODE_STRIPPING = YES;
11651179
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
11661180
INFOPLIST_FILE = "$(SRCROOT)/Tests/Mac/Info.plist";
11671181
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
1168-
MACOSX_DEPLOYMENT_TARGET = 10.15;
1182+
MACOSX_DEPLOYMENT_TARGET = 12.0;
11691183
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-MacTests";
11701184
PRODUCT_NAME = "$(TARGET_NAME)";
11711185
SDKROOT = macosx;
@@ -1221,13 +1235,15 @@
12211235
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
12221236
GCC_WARN_UNUSED_FUNCTION = YES;
12231237
GCC_WARN_UNUSED_VARIABLE = YES;
1224-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
1238+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
1239+
MACOSX_DEPLOYMENT_TARGET = 12.0;
12251240
MTL_ENABLE_DEBUG_INFO = YES;
12261241
ONLY_ACTIVE_ARCH = YES;
12271242
SDKROOT = iphoneos;
12281243
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
12291244
SWIFT_VERSION = 5.0;
12301245
TARGETED_DEVICE_FAMILY = "1,2";
1246+
TVOS_DEPLOYMENT_TARGET = 16.0;
12311247
VERSIONING_SYSTEM = "apple-generic";
12321248
VERSION_INFO_PREFIX = "";
12331249
};
@@ -1276,12 +1292,14 @@
12761292
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
12771293
GCC_WARN_UNUSED_FUNCTION = YES;
12781294
GCC_WARN_UNUSED_VARIABLE = YES;
1279-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
1295+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
1296+
MACOSX_DEPLOYMENT_TARGET = 12.0;
12801297
MTL_ENABLE_DEBUG_INFO = NO;
12811298
SDKROOT = iphoneos;
12821299
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
12831300
SWIFT_VERSION = 5.0;
12841301
TARGETED_DEVICE_FAMILY = "1,2";
1302+
TVOS_DEPLOYMENT_TARGET = 16.0;
12851303
VALIDATE_PRODUCT = YES;
12861304
VERSIONING_SYSTEM = "apple-generic";
12871305
VERSION_INFO_PREFIX = "";
@@ -1299,7 +1317,7 @@
12991317
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
13001318
INFOPLIST_FILE = "$(SRCROOT)/SupportFiles/iOS/Info.plist";
13011319
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1302-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
1320+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
13031321
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
13041322
PRODUCT_BUNDLE_IDENTIFIER = no.hyper.Cache;
13051323
PRODUCT_NAME = Cache;
@@ -1320,7 +1338,7 @@
13201338
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
13211339
INFOPLIST_FILE = "$(SRCROOT)/SupportFiles/iOS/Info.plist";
13221340
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1323-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
1341+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
13241342
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
13251343
PRODUCT_BUNDLE_IDENTIFIER = no.hyper.Cache;
13261344
PRODUCT_NAME = Cache;

Cache.xcodeproj/xcshareddata/xcschemes/Cache-iOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1200"
3+
LastUpgradeVersion = "1400"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Cache.xcodeproj/xcshareddata/xcschemes/Cache-macOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1200"
3+
LastUpgradeVersion = "1400"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Cache.xcodeproj/xcshareddata/xcschemes/Cache-tvOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1200"
3+
LastUpgradeVersion = "1400"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Package.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.7
22

33
import PackageDescription
44

@@ -18,7 +18,8 @@ let package = Package(
1818
.testTarget(
1919
name: "CacheTests",
2020
dependencies: ["Cache"],
21-
path: "Tests"),
21+
path: "Tests"
22+
),
2223
],
2324
swiftLanguageVersions: [.v5]
2425
)

Playgrounds/SimpleStorage.playground/Contents.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct User: Codable {
77
let id: Int
88
let firstName: String
99
let lastName: String
10-
10+
1111
var name: String {
1212
return "\(firstName) \(lastName)"
1313
}
@@ -17,9 +17,9 @@ let diskConfig = DiskConfig(name: "UserCache")
1717
let memoryConfig = MemoryConfig(expiry: .never, countLimit: 10, totalCostLimit: 10)
1818

1919
let storage = try! Storage(
20-
diskConfig: diskConfig,
21-
memoryConfig: memoryConfig,
22-
transformer: TransformerFactory.forCodable(ofType: User.self)
20+
diskConfig: diskConfig,
21+
memoryConfig: memoryConfig,
22+
transformer: TransformerFactory.forCodable(ofType: User.self)
2323
)
2424

2525
let user = User(id: 1, firstName: "John", lastName: "Snow")

Playgrounds/Storage.playground/Contents.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ import Cache
66
struct Helper {
77
static func image(_ color: UIColor = .red, size: CGSize = .init(width: 1, height: 1)) -> UIImage {
88
UIGraphicsBeginImageContextWithOptions(size, false, 1)
9-
9+
1010
let context = UIGraphicsGetCurrentContext()
1111
context?.setFillColor(color.cgColor)
1212
context?.fill(CGRect(x: 0, y: 0, width: size.width, height: size.height))
13-
13+
1414
let image = UIGraphicsGetImageFromCurrentImageContext()
1515
UIGraphicsEndImageContext()
16-
16+
1717
return image!
1818
}
19-
20-
static func data(length: Int) -> Data {
21-
var buffer = [UInt8](repeating: 0, count: length)
22-
return Data(bytes: &buffer, count: length)
23-
}
19+
20+
static func data(length: Int) -> Data {
21+
var buffer = [UInt8](repeating: 0, count: length)
22+
return Data(bytes: &buffer, count: length)
23+
}
2424
}
2525

2626
// MARK: - Storage
2727

2828
let diskConfig = DiskConfig(name: "Mix")
2929

3030
let dataStorage = try! Storage(
31-
diskConfig: diskConfig,
32-
memoryConfig: MemoryConfig(),
33-
transformer: TransformerFactory.forData()
31+
diskConfig: diskConfig,
32+
memoryConfig: MemoryConfig(),
33+
transformer: TransformerFactory.forData()
3434
)
3535

3636
let stringStorage = dataStorage.transformCodable(ofType: String.self)

0 commit comments

Comments
 (0)