Skip to content

Commit

Permalink
Merge pull request #28 from mjarvis/swift_deprecations
Browse files Browse the repository at this point in the history
Update code to conform to swift 2.2 deprecations
  • Loading branch information
Ben-G committed Jun 8, 2016
2 parents 2af0cc9 + cdb3fe1 commit 5c5d850
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions ReSwiftRouter/NavigationReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,23 @@ public struct NavigationReducer {
return state
}

static func setRoute(var state: NavigationState, setRouteAction: SetRouteAction) -> NavigationState {
static func setRoute(state: NavigationState, setRouteAction: SetRouteAction) -> NavigationState {
var state = state

state.route = setRouteAction.route
state.changeRouteAnimated = setRouteAction.animated

return state
}

static func setRouteSpecificData(
var state: NavigationState,
state: NavigationState,
route: Route,
data: Any) -> NavigationState{
let routeHash = RouteHash(route: route)

var state = state

state.routeSpecificState[routeHash] = data

return state
Expand Down
8 changes: 4 additions & 4 deletions ReSwiftRouter/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public class Router<State: StateType>: StoreSubscriber {
while largestCommonSubroute + 1 < newRoute.count &&
largestCommonSubroute + 1 < oldRoute.count &&
newRoute[largestCommonSubroute + 1] == oldRoute[largestCommonSubroute + 1] {
largestCommonSubroute++
largestCommonSubroute += 1
}

return largestCommonSubroute
Expand Down Expand Up @@ -153,7 +153,7 @@ public class Router<State: StateType>: StoreSubscriber {
)

routingActions.append(popAction)
routeBuildingIndex--
routeBuildingIndex -= 1
}

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

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

routingActions.append(pushAction)
routeBuildingIndex++
routeBuildingIndex += 1
}

return routingActions
Expand Down

0 comments on commit 5c5d850

Please sign in to comment.