Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Swift 5 #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Cache.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Pod::Spec.new do |s|

s.frameworks = 'Foundation'

s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.2' }
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '5.0' }
end
17 changes: 16 additions & 1 deletion Cache.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = "Hyper Interaktiv AS";
TargetAttributes = {
BDEDD3551DBCE5B1007416A6 = {
Expand Down Expand Up @@ -700,6 +700,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = D5DC59D61C20593E003BD79B;
Expand Down Expand Up @@ -999,6 +1000,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
Expand All @@ -1024,6 +1026,7 @@
PRODUCT_NAME = Cache;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
Expand All @@ -1045,6 +1048,7 @@
SDKROOT = appletvos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Debug;
Expand All @@ -1063,6 +1067,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-tvOS-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Release;
Expand All @@ -1077,6 +1082,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-iOS-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1089,6 +1095,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-iOS-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -1111,6 +1118,7 @@
PRODUCT_NAME = Cache;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1133,6 +1141,7 @@
PRODUCT_NAME = Cache;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -1148,6 +1157,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-MacTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1163,13 +1173,15 @@
PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Cache-MacTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_VERSION = 5.0;
};
name = Release;
};
D5DC59F21C20593E003BD79B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -1229,6 +1241,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -1294,6 +1307,7 @@
PRODUCT_BUNDLE_IDENTIFIER = no.hyper.Cache;
PRODUCT_NAME = Cache;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1313,6 +1327,7 @@
PRODUCT_BUNDLE_IDENTIFIER = no.hyper.Cache;
PRODUCT_NAME = Cache;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
24 changes: 10 additions & 14 deletions Cache.xcodeproj/xcshareddata/xcschemes/Cache-iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5DC59DF1C20593E003BD79B"
BuildableName = "Cache.framework"
BlueprintName = "Cache-iOS"
ReferencedContainer = "container:Cache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
Expand All @@ -41,17 +50,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5DC59DF1C20593E003BD79B"
BuildableName = "Cache.framework"
BlueprintName = "Cache-iOS"
ReferencedContainer = "container:Cache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -72,8 +70,6 @@
ReferencedContainer = "container:Cache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
24 changes: 10 additions & 14 deletions Cache.xcodeproj/xcshareddata/xcschemes/Cache-macOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -41,6 +41,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5291D5F1C283B5300B702C9"
BuildableName = "Cache.framework"
BlueprintName = "Cache-Mac"
ReferencedContainer = "container:Cache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
Expand All @@ -55,17 +64,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5291D5F1C283B5300B702C9"
BuildableName = "Cache.framework"
BlueprintName = "Cache-Mac"
ReferencedContainer = "container:Cache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -86,8 +84,6 @@
ReferencedContainer = "container:Cache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
24 changes: 10 additions & 14 deletions Cache.xcodeproj/xcshareddata/xcschemes/Cache-tvOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BDEDD3551DBCE5B1007416A6"
BuildableName = "Cache.framework"
BlueprintName = "Cache-tvOS"
ReferencedContainer = "container:Cache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
Expand All @@ -41,17 +50,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BDEDD3551DBCE5B1007416A6"
BuildableName = "Cache.framework"
BlueprintName = "Cache-tvOS"
ReferencedContainer = "container:Cache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -72,8 +70,6 @@
ReferencedContainer = "container:Cache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
7 changes: 4 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:4.2
// swift-tools-version:5.1

import PackageDescription

Expand All @@ -13,11 +13,12 @@ let package = Package(
targets: [
.target(
name: "Cache",
path: "Source/Shared",
path: "Source",
exclude: ["Library/ImageWrapper.swift"]), // relative to the target path
.testTarget(
name: "CacheTests",
dependencies: ["Cache"],
path: "Tests"),
]
],
swiftLanguageVersions: [.v5]
)
3 changes: 3 additions & 0 deletions Source/Mac/NSImage+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(AppKit)
import AppKit

/// Helper UIImage extension.
Expand Down Expand Up @@ -34,3 +35,5 @@ extension NSImage {
.representation(using: imageFileType, properties: [:])
}
}

#endif
1 change: 1 addition & 0 deletions Source/Shared/Configuration/MemoryConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ public struct MemoryConfig {
self.countLimit = countLimit
self.totalCostLimit = totalCostLimit
}

}
1 change: 1 addition & 0 deletions Source/Shared/Extensions/Date+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ extension Date {
var inThePast: Bool {
return timeIntervalSinceNow < 0
}

}
1 change: 1 addition & 0 deletions Source/Shared/Extensions/JSONDecoder+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ public extension JSONDecoder {
static func decode<T: Codable>(_ data: Data, to type: T.Type) throws -> T {
return try JSONDecoder().decode(T.self, from: data)
}

}
2 changes: 2 additions & 0 deletions Source/Shared/Library/ImageWrapper.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

public struct ImageWrapper: Codable {

public let image: Image

public enum CodingKeys: String, CodingKey {
Expand Down Expand Up @@ -29,4 +30,5 @@ public struct ImageWrapper: Codable {

try container.encode(data, forKey: CodingKeys.image)
}

}
2 changes: 2 additions & 0 deletions Source/Shared/Library/TransformerFactory.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

public class TransformerFactory {

public static func forData() -> Transformer<Data> {
let toData: (Data) throws -> Data = { $0 }

Expand Down Expand Up @@ -35,4 +36,5 @@ public class TransformerFactory {

return Transformer<U>(toData: toData, fromData: fromData)
}

}
9 changes: 3 additions & 6 deletions Source/iOS/UIImage+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(UIKit)
import UIKit

/// Helper UIImage extension.
Expand All @@ -22,14 +23,10 @@ extension UIImage {

/// Convert to data
func cache_toData() -> Data? {
#if swift(>=4.2)
return hasAlpha
? pngData()
: jpegData(compressionQuality: 1.0)
#else
return hasAlpha
? UIImagePNGRepresentation(self)
: UIImageJPEGRepresentation(self, 1.0)
#endif
}
}

#endif
Loading