Skip to content

Commit 5c5d850

Browse files
committed
Merge pull request #28 from mjarvis/swift_deprecations
Update code to conform to swift 2.2 deprecations
2 parents 2af0cc9 + cdb3fe1 commit 5c5d850

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

ReSwiftRouter/NavigationReducer.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,23 @@ public struct NavigationReducer {
3131
return state
3232
}
3333

34-
static func setRoute(var state: NavigationState, setRouteAction: SetRouteAction) -> NavigationState {
34+
static func setRoute(state: NavigationState, setRouteAction: SetRouteAction) -> NavigationState {
35+
var state = state
36+
3537
state.route = setRouteAction.route
3638
state.changeRouteAnimated = setRouteAction.animated
3739

3840
return state
3941
}
4042

4143
static func setRouteSpecificData(
42-
var state: NavigationState,
44+
state: NavigationState,
4345
route: Route,
4446
data: Any) -> NavigationState{
4547
let routeHash = RouteHash(route: route)
4648

49+
var state = state
50+
4751
state.routeSpecificState[routeHash] = data
4852

4953
return state

ReSwiftRouter/Router.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public class Router<State: StateType>: StoreSubscriber {
105105
while largestCommonSubroute + 1 < newRoute.count &&
106106
largestCommonSubroute + 1 < oldRoute.count &&
107107
newRoute[largestCommonSubroute + 1] == oldRoute[largestCommonSubroute + 1] {
108-
largestCommonSubroute++
108+
largestCommonSubroute += 1
109109
}
110110

111111
return largestCommonSubroute
@@ -153,7 +153,7 @@ public class Router<State: StateType>: StoreSubscriber {
153153
)
154154

155155
routingActions.append(popAction)
156-
routeBuildingIndex--
156+
routeBuildingIndex -= 1
157157
}
158158

159159
// This is the 1. case:
@@ -166,7 +166,7 @@ public class Router<State: StateType>: StoreSubscriber {
166166
)
167167

168168
routingActions.append(popAction)
169-
routeBuildingIndex--
169+
routeBuildingIndex -= 1
170170
}
171171
// This is the 3. case:
172172
// "The new route has a different element after the commonSubroute, we need to replace
@@ -195,7 +195,7 @@ public class Router<State: StateType>: StoreSubscriber {
195195
)
196196

197197
routingActions.append(pushAction)
198-
routeBuildingIndex++
198+
routeBuildingIndex += 1
199199
}
200200

201201
return routingActions

0 commit comments

Comments
 (0)