Skip to content

Commit

Permalink
Feature: backward compatibility (ios11 support) (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhenry authored Dec 20, 2022
1 parent 19859f6 commit 00fb21d
Show file tree
Hide file tree
Showing 27 changed files with 351 additions and 310 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ jobs:
${{ env.DERIVEDDATA_PATH }}/SourcePackages/checkouts/
key: ${{ runner.os }}-${{ hashFiles('**/Package.resolved') }}

- run: xcodebuild test -project Demo/Demo.xcodeproj -scheme Demo -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -enableCodeCoverage YES -derivedDataPath ${{ env.DERIVEDDATA_PATH }} | xcpretty
- run: xcodebuild test -project Demo/Demo.xcodeproj -scheme Demo -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -enableCodeCoverage YES -derivedDataPath ${{ env.DERIVEDDATA_PATH }} | xcpretty
- uses: michaelhenry/swifty-code-coverage@v1.0.1
with:
build-path: ${{ env.DERIVEDDATA_PATH }}
target: Demo.app
is-spm: false
ignore-filename-regex: 'Demo|ViewController|DerivedData|.libs'
ignore-filename-regex: 'Demo|ViewController|DerivedData|.libs|AnyDiffableDataSource'

- name: Upload to Codecov
run: |
Expand Down
6 changes: 2 additions & 4 deletions Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
9920815C28F837DC009263C5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9920815B28F837DC009263C5 /* AppDelegate.swift */; };
9920815E28F837DC009263C5 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9920815D28F837DC009263C5 /* SceneDelegate.swift */; };
9920816028F837DC009263C5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9920815F28F837DC009263C5 /* ViewController.swift */; };
9920816328F837DC009263C5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9920816128F837DC009263C5 /* Main.storyboard */; };
9920816528F837DD009263C5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9920816428F837DD009263C5 /* Assets.xcassets */; };
Expand Down Expand Up @@ -39,7 +38,6 @@
/* Begin PBXFileReference section */
9920815828F837DC009263C5 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
9920815B28F837DC009263C5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
9920815D28F837DC009263C5 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
9920815F28F837DC009263C5 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
9920816228F837DC009263C5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
9920816428F837DD009263C5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -102,7 +100,6 @@
isa = PBXGroup;
children = (
9920815B28F837DC009263C5 /* AppDelegate.swift */,
9920815D28F837DC009263C5 /* SceneDelegate.swift */,
9920815F28F837DC009263C5 /* ViewController.swift */,
9920819228F844EA009263C5 /* AppConfigs.swift */,
99C7400C2912A4640039CA69 /* UserDefaults++.swift */,
Expand Down Expand Up @@ -266,7 +263,6 @@
99C7400D2912A4640039CA69 /* UserDefaults++.swift in Sources */,
9920815C28F837DC009263C5 /* AppDelegate.swift in Sources */,
9920819328F844EA009263C5 /* AppConfigs.swift in Sources */,
9920815E28F837DC009263C5 /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -440,6 +436,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -467,6 +464,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
"object": {
"pins": [
{
"package": "CombineCocoa",
"repositoryURL": "https://github.com/CombineCommunity/CombineCocoa",
"package": "DiffableDataSources",
"repositoryURL": "https://github.com/ra1028/DiffableDataSources",
"state": {
"branch": null,
"revision": "4e262c2f9fb1cee1cb3be5717f7e6b55eb823971",
"version": "0.4.0"
"revision": "a457cf63456b3aeec2a3626af0230c98b0733927",
"version": "0.5.0"
}
},
{
"package": "CombineExt",
"repositoryURL": "https://github.com/CombineCommunity/CombineExt",
"package": "DifferenceKit",
"repositoryURL": "https://github.com/ra1028/DifferenceKit.git",
"state": {
"branch": null,
"revision": "aaf1a0981c05360000af972473034cb952be4ca0",
"version": "1.8.0"
"revision": "62745d7780deef4a023a792a1f8f763ec7bf9705",
"version": "1.2.0"
}
},
{
Expand All @@ -37,6 +37,15 @@
"version": "1.1.1"
}
},
{
"package": "RxSwift",
"repositoryURL": "https://github.com/ReactiveX/RxSwift",
"state": {
"branch": null,
"revision": "b4307ba0b6425c0ba4178e138799946c3da594f8",
"version": "6.5.0"
}
},
{
"package": "swift-snapshot-testing",
"repositoryURL": "https://github.com/pointfreeco/swift-snapshot-testing.git",
Expand Down
18 changes: 3 additions & 15 deletions Demo/Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import UIKit
import XConfigs

@main
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let kvProvider = SampleKeyValueProvider()
XConfigs.configure(with: AppConfigs.self, keyValueProvider: kvProvider, keyValueStore: UserDefaults.standard)
Expand All @@ -14,18 +16,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

return true
}

// MARK: UISceneSession Lifecycle

func application(_: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options _: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_: UIApplication, didDiscardSceneSessions _: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
22 changes: 1 addition & 21 deletions Demo/Demo/Info.plist
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
</dict>
<dict/>
</plist>
8 changes: 5 additions & 3 deletions Demo/Demo/SampleKeyValueProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ final class SampleKeyValueProvider: KeyValueProvider {
private var keyValues: [String: String] = [:]

func download(completion: @escaping ((Bool) -> Void)) {
Task {
URLSession.shared.dataTask(with: URLRequest(url: remoteKeyValuesURL)) { [weak self] data, _, _ in
guard let data, let self else {
completion(false)
return
}
do {
let (data, _) = try await URLSession.shared.data(from: self.remoteKeyValuesURL)
let jsonObject = try JSONSerialization.jsonObject(with: data) as? [String: Any] ?? [:]
self.keyValues = jsonObject.reduce(into: [String: String]()) {
$0[$1.key] = String(describing: $1.value)
Expand All @@ -17,7 +20,6 @@ final class SampleKeyValueProvider: KeyValueProvider {
completion(true)
} catch {
completion(false)
print("ERROR", error)
}
}
}
Expand Down
40 changes: 0 additions & 40 deletions Demo/Demo/SceneDelegate.swift

This file was deleted.

Loading

0 comments on commit 00fb21d

Please sign in to comment.