Skip to content

Commit 6749d6b

Browse files
committed
[Global] Update codebase to new version of ReSwift & ReSwiftRouter.
1 parent e59987a commit 6749d6b

File tree

6 files changed

+92
-56
lines changed

6 files changed

+92
-56
lines changed

SwiftFlowGitHubBrowser.xcodeproj/project.pbxproj

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
/* End PBXBuildFile section */
5050

5151
/* Begin PBXContainerItemProxy section */
52+
14423EA61ECB43EF0099AE91 /* PBXContainerItemProxy */ = {
53+
isa = PBXContainerItemProxy;
54+
containerPortal = 254B3B4D1D3ABBB400B1E4F0 /* ReSwift.xcodeproj */;
55+
proxyType = 2;
56+
remoteGlobalIDString = 3F13C0E81E7B3E4000D8442C;
57+
remoteInfo = SwiftLintIntegration;
58+
};
5259
253038F31D92D8B900AA49F4 /* PBXContainerItemProxy */ = {
5360
isa = PBXContainerItemProxy;
5461
containerPortal = 253038E91D92D8B900AA49F4 /* SAMKeychain.xcodeproj */;
@@ -615,6 +622,7 @@
615622
254B3B601D3ABBB400B1E4F0 /* ReSwift.framework */,
616623
254B3B621D3ABBB400B1E4F0 /* ReSwift-tvOSTests.xctest */,
617624
254B3B641D3ABBB400B1E4F0 /* ReSwift.framework */,
625+
14423EA71ECB43EF0099AE91 /* SwiftLintIntegration.xctest */,
618626
);
619627
name = Products;
620628
sourceTree = "<group>";
@@ -834,17 +842,17 @@
834842
isa = PBXGroup;
835843
children = (
836844
62EF0A8D1C700D1200D13711 /* Quick.framework */,
837-
62EF0A8F1C700D1200D13711 /* Quick-macOSTests.xctest */,
838-
62EF0A911C700D1200D13711 /* QuickFocused-macOSTests.xctest */,
839-
2565B8871DE74F440016371D /* QuickAfterSuite-macOSTests.xctest */,
845+
62EF0A8F1C700D1200D13711 /* Quick - macOSTests.xctest */,
846+
62EF0A911C700D1200D13711 /* QuickFocused - macOSTests.xctest */,
847+
2565B8871DE74F440016371D /* QuickAfterSuite - macOSTests.xctest */,
840848
62EF0A931C700D1200D13711 /* Quick.framework */,
841-
62EF0A951C700D1200D13711 /* Quick-iOSTests.xctest */,
842-
62EF0A971C700D1200D13711 /* QuickFocused-iOSTests.xctest */,
843-
2565B8891DE74F440016371D /* QuickAfterSuite-iOSTests.xctest */,
849+
62EF0A951C700D1200D13711 /* Quick - iOSTests.xctest */,
850+
62EF0A971C700D1200D13711 /* QuickFocused - iOSTests.xctest */,
851+
2565B8891DE74F440016371D /* QuickAfterSuite - iOSTests.xctest */,
844852
62EF0A991C700D1200D13711 /* Quick.framework */,
845-
62EF0A9B1C700D1200D13711 /* Quick-tvOSTests.xctest */,
846-
62EF0A9D1C700D1200D13711 /* QuickFocused-tvOSTests.xctest */,
847-
2565B88B1DE74F440016371D /* QuickAfterSuite-tvOSTests.xctest */,
853+
62EF0A9B1C700D1200D13711 /* Quick - tvOSTests.xctest */,
854+
62EF0A9D1C700D1200D13711 /* QuickFocused - tvOSTests.xctest */,
855+
2565B88B1DE74F440016371D /* QuickAfterSuite - tvOSTests.xctest */,
848856
);
849857
name = Products;
850858
sourceTree = "<group>";
@@ -881,6 +889,7 @@
881889
25BB761A1C3CB8CB008EA13B /* Frameworks */,
882890
25BB761B1C3CB8CB008EA13B /* Resources */,
883891
7A7A57071C91D73C00670D38 /* Embed Frameworks */,
892+
14423EB51ECB44250099AE91 /* ShellScript */,
884893
);
885894
buildRules = (
886895
);
@@ -989,6 +998,13 @@
989998
/* End PBXProject section */
990999

9911000
/* Begin PBXReferenceProxy section */
1001+
14423EA71ECB43EF0099AE91 /* SwiftLintIntegration.xctest */ = {
1002+
isa = PBXReferenceProxy;
1003+
fileType = wrapper.cfbundle;
1004+
path = SwiftLintIntegration.xctest;
1005+
remoteRef = 14423EA61ECB43EF0099AE91 /* PBXContainerItemProxy */;
1006+
sourceTree = BUILT_PRODUCTS_DIR;
1007+
};
9921008
253038F41D92D8B900AA49F4 /* SAMKeychain.framework */ = {
9931009
isa = PBXReferenceProxy;
9941010
fileType = wrapper.framework;
@@ -1234,24 +1250,24 @@
12341250
remoteRef = 254B3B931D3ABBCE00B1E4F0 /* PBXContainerItemProxy */;
12351251
sourceTree = BUILT_PRODUCTS_DIR;
12361252
};
1237-
2565B8871DE74F440016371D /* QuickAfterSuite-macOSTests.xctest */ = {
1253+
2565B8871DE74F440016371D /* QuickAfterSuite - macOSTests.xctest */ = {
12381254
isa = PBXReferenceProxy;
12391255
fileType = wrapper.cfbundle;
1240-
path = "QuickAfterSuite-macOSTests.xctest";
1256+
path = "QuickAfterSuite - macOSTests.xctest";
12411257
remoteRef = 2565B8861DE74F440016371D /* PBXContainerItemProxy */;
12421258
sourceTree = BUILT_PRODUCTS_DIR;
12431259
};
1244-
2565B8891DE74F440016371D /* QuickAfterSuite-iOSTests.xctest */ = {
1260+
2565B8891DE74F440016371D /* QuickAfterSuite - iOSTests.xctest */ = {
12451261
isa = PBXReferenceProxy;
12461262
fileType = wrapper.cfbundle;
1247-
path = "QuickAfterSuite-iOSTests.xctest";
1263+
path = "QuickAfterSuite - iOSTests.xctest";
12481264
remoteRef = 2565B8881DE74F440016371D /* PBXContainerItemProxy */;
12491265
sourceTree = BUILT_PRODUCTS_DIR;
12501266
};
1251-
2565B88B1DE74F440016371D /* QuickAfterSuite-tvOSTests.xctest */ = {
1267+
2565B88B1DE74F440016371D /* QuickAfterSuite - tvOSTests.xctest */ = {
12521268
isa = PBXReferenceProxy;
12531269
fileType = wrapper.cfbundle;
1254-
path = "QuickAfterSuite-tvOSTests.xctest";
1270+
path = "QuickAfterSuite - tvOSTests.xctest";
12551271
remoteRef = 2565B88A1DE74F440016371D /* PBXContainerItemProxy */;
12561272
sourceTree = BUILT_PRODUCTS_DIR;
12571273
};
@@ -1290,17 +1306,17 @@
12901306
remoteRef = 62EF0A8C1C700D1200D13711 /* PBXContainerItemProxy */;
12911307
sourceTree = BUILT_PRODUCTS_DIR;
12921308
};
1293-
62EF0A8F1C700D1200D13711 /* Quick-macOSTests.xctest */ = {
1309+
62EF0A8F1C700D1200D13711 /* Quick - macOSTests.xctest */ = {
12941310
isa = PBXReferenceProxy;
12951311
fileType = wrapper.cfbundle;
1296-
path = "Quick-macOSTests.xctest";
1312+
path = "Quick - macOSTests.xctest";
12971313
remoteRef = 62EF0A8E1C700D1200D13711 /* PBXContainerItemProxy */;
12981314
sourceTree = BUILT_PRODUCTS_DIR;
12991315
};
1300-
62EF0A911C700D1200D13711 /* QuickFocused-macOSTests.xctest */ = {
1316+
62EF0A911C700D1200D13711 /* QuickFocused - macOSTests.xctest */ = {
13011317
isa = PBXReferenceProxy;
13021318
fileType = wrapper.cfbundle;
1303-
path = "QuickFocused-macOSTests.xctest";
1319+
path = "QuickFocused - macOSTests.xctest";
13041320
remoteRef = 62EF0A901C700D1200D13711 /* PBXContainerItemProxy */;
13051321
sourceTree = BUILT_PRODUCTS_DIR;
13061322
};
@@ -1311,17 +1327,17 @@
13111327
remoteRef = 62EF0A921C700D1200D13711 /* PBXContainerItemProxy */;
13121328
sourceTree = BUILT_PRODUCTS_DIR;
13131329
};
1314-
62EF0A951C700D1200D13711 /* Quick-iOSTests.xctest */ = {
1330+
62EF0A951C700D1200D13711 /* Quick - iOSTests.xctest */ = {
13151331
isa = PBXReferenceProxy;
13161332
fileType = wrapper.cfbundle;
1317-
path = "Quick-iOSTests.xctest";
1333+
path = "Quick - iOSTests.xctest";
13181334
remoteRef = 62EF0A941C700D1200D13711 /* PBXContainerItemProxy */;
13191335
sourceTree = BUILT_PRODUCTS_DIR;
13201336
};
1321-
62EF0A971C700D1200D13711 /* QuickFocused-iOSTests.xctest */ = {
1337+
62EF0A971C700D1200D13711 /* QuickFocused - iOSTests.xctest */ = {
13221338
isa = PBXReferenceProxy;
13231339
fileType = wrapper.cfbundle;
1324-
path = "QuickFocused-iOSTests.xctest";
1340+
path = "QuickFocused - iOSTests.xctest";
13251341
remoteRef = 62EF0A961C700D1200D13711 /* PBXContainerItemProxy */;
13261342
sourceTree = BUILT_PRODUCTS_DIR;
13271343
};
@@ -1332,17 +1348,17 @@
13321348
remoteRef = 62EF0A981C700D1200D13711 /* PBXContainerItemProxy */;
13331349
sourceTree = BUILT_PRODUCTS_DIR;
13341350
};
1335-
62EF0A9B1C700D1200D13711 /* Quick-tvOSTests.xctest */ = {
1351+
62EF0A9B1C700D1200D13711 /* Quick - tvOSTests.xctest */ = {
13361352
isa = PBXReferenceProxy;
13371353
fileType = wrapper.cfbundle;
1338-
path = "Quick-tvOSTests.xctest";
1354+
path = "Quick - tvOSTests.xctest";
13391355
remoteRef = 62EF0A9A1C700D1200D13711 /* PBXContainerItemProxy */;
13401356
sourceTree = BUILT_PRODUCTS_DIR;
13411357
};
1342-
62EF0A9D1C700D1200D13711 /* QuickFocused-tvOSTests.xctest */ = {
1358+
62EF0A9D1C700D1200D13711 /* QuickFocused - tvOSTests.xctest */ = {
13431359
isa = PBXReferenceProxy;
13441360
fileType = wrapper.cfbundle;
1345-
path = "QuickFocused-tvOSTests.xctest";
1361+
path = "QuickFocused - tvOSTests.xctest";
13461362
remoteRef = 62EF0A9C1C700D1200D13711 /* PBXContainerItemProxy */;
13471363
sourceTree = BUILT_PRODUCTS_DIR;
13481364
};
@@ -1410,6 +1426,22 @@
14101426
};
14111427
/* End PBXResourcesBuildPhase section */
14121428

1429+
/* Begin PBXShellScriptBuildPhase section */
1430+
14423EB51ECB44250099AE91 /* ShellScript */ = {
1431+
isa = PBXShellScriptBuildPhase;
1432+
buildActionMask = 2147483647;
1433+
files = (
1434+
);
1435+
inputPaths = (
1436+
);
1437+
outputPaths = (
1438+
);
1439+
runOnlyForDeploymentPostprocessing = 0;
1440+
shellPath = /bin/sh;
1441+
shellScript = "/usr/local/bin/carthage copy-frameworks";
1442+
};
1443+
/* End PBXShellScriptBuildPhase section */
1444+
14131445
/* Begin PBXSourcesBuildPhase section */
14141446
25BB76191C3CB8CB008EA13B /* Sources */ = {
14151447
isa = PBXSourcesBuildPhase;
@@ -1591,7 +1623,10 @@
15911623
buildSettings = {
15921624
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
15931625
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
1594-
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
1626+
FRAMEWORK_SEARCH_PATHS = (
1627+
"$(inherited)/**",
1628+
"$(SRCROOT)/Carthage/Build/iOS/**",
1629+
);
15951630
INFOPLIST_FILE = SwiftFlowGitHubBrowser/Info.plist;
15961631
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
15971632
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1606,7 +1641,10 @@
16061641
buildSettings = {
16071642
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
16081643
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
1609-
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
1644+
FRAMEWORK_SEARCH_PATHS = (
1645+
"$(inherited)/**",
1646+
"$(SRCROOT)/Carthage/Build/iOS/**",
1647+
);
16101648
INFOPLIST_FILE = SwiftFlowGitHubBrowser/Info.plist;
16111649
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
16121650
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

SwiftFlowGitHubBrowser/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import OctoKit
1111
import ReSwift
1212
import ReSwiftRouter
1313

14-
var store = Store<State>(reducer: AppReducer(), state: nil)
14+
var store = Store<State>(reducer: appReducer, state: nil)
1515

1616
@UIApplicationMain
1717
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -34,7 +34,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3434
let rootRoutable = RootRoutable(window: window!)
3535

3636
router = Router(store: store, rootRoutable: rootRoutable) { state in
37-
return state.navigationState
37+
state.select { $0.navigationState }
3838
}
3939

4040
if case .loggedIn(_) = store.state.authenticationState.loggedInState {

SwiftFlowGitHubBrowser/Reducers/AppReducer.swift

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@
99
import ReSwift
1010
import ReSwiftRouter
1111

12-
struct AppReducer: Reducer {
13-
14-
func handleAction(action: Action, state: State?) -> State {
15-
return State(
16-
navigationState: NavigationReducer.handleAction(action, state: state?.navigationState),
17-
authenticationState: authenticationReducer(state: state?.authenticationState, action: action),
18-
repositories: repositoriesReducer(state: state?.repositories, action: action),
19-
bookmarks: bookmarksReducer(state: state?.bookmarks, action: action)
20-
)
21-
}
22-
12+
func appReducer(action: Action, state: State?) -> State {
13+
return State(
14+
navigationState: NavigationReducer.handleAction(action, state: state?.navigationState),
15+
authenticationState: authenticationReducer(state: state?.authenticationState, action: action),
16+
repositories: repositoriesReducer(state: state?.repositories, action: action),
17+
bookmarks: bookmarksReducer(state: state?.bookmarks, action: action)
18+
)
2319
}

SwiftFlowGitHubBrowser/ViewControllers/BookmarkViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BookmarkViewController: UIViewController, StoreSubscriber {
2727

2828
// Subscribe after other setup is complete
2929
store.subscribe(self) { state in
30-
state.bookmarks
30+
state.select { $0.bookmarks }
3131
}
3232
}
3333

SwiftFlowGitHubBrowser/ViewControllers/MainViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MainViewController: UIViewController, StoreSubscriber {
2525
super.viewWillAppear(animated)
2626

2727
store.subscribe(self) { state in
28-
state.repositories
28+
state.select { $0.repositories }
2929
}
3030

3131
// Kick off request to update list of repositories

SwiftFlowGitHubBrowser/ViewControllers/RepositoryDetailViewController.swift

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ class RepositoryDetailViewController: UIViewController, StoreSubscriber {
2424
super.viewWillAppear(animated)
2525

2626
store.subscribe(self) { state in
27-
let currentRepository: Repository? = state.navigationState.getRouteSpecificState(
28-
state.navigationState.route
29-
)
30-
31-
let isCurrentRepositoryBookmarked = currentRepository.map {
32-
BookmarkService.isRepositoryBookmarked(state: state, currentRepository: $0)
33-
} ?? false
34-
35-
return (
36-
currentRepository,
37-
isCurrentRepositoryBookmarked
38-
)
27+
state.select { currentState in
28+
let currentRepository: Repository? = currentState.navigationState.getRouteSpecificState(
29+
currentState.navigationState.route
30+
)
31+
32+
let isCurrentRepositoryBookmarked = currentRepository.map {
33+
BookmarkService.isRepositoryBookmarked(state: currentState, currentRepository: $0)
34+
} ?? false
35+
36+
return (
37+
currentRepository,
38+
isCurrentRepositoryBookmarked
39+
)
40+
}
3941
}
4042
}
4143

0 commit comments

Comments
 (0)