Skip to content

Commit

Permalink
Merge pull request #16 from alickbass/router-to-endpoint
Browse files Browse the repository at this point in the history
Rename RouterType protocol to EndpointType protocol
  • Loading branch information
Oleksii Dykan authored Mar 23, 2017
2 parents 884baa5 + c62a0df commit 7f5e70d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Declarative URL routing in swift
Here is an example of the Router for some back-end `API`:

```swift
struct Api: RouterType {
struct Api: EndpointType {
enum Environment: EnvironmentType {
case localhost
case test
Expand Down Expand Up @@ -56,7 +56,7 @@ print(Router<Api>(.production, at: .posts(for: Date())).url) // https://myproduc
It can often happen, that you will be using some third-party `API` and you will have only access to Production environment. So in this case your Router will look something like this:

```swift
struct Auth: RouterType {
struct Auth: EndpointType {
enum Route: RouteType {
case signIn, signOut

Expand Down
4 changes: 2 additions & 2 deletions SweetRouter/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct Router<T: RouterType>: URLRepresentable {
public struct Router<T: EndpointType>: URLRepresentable {
public let environment: T.Environment
public let route: T.Route

Expand Down Expand Up @@ -40,7 +40,7 @@ public extension URLRepresentable {
}
}

public protocol RouterType {
public protocol EndpointType {
associatedtype Environment: EnvironmentType
associatedtype Route: RouteType

Expand Down
4 changes: 2 additions & 2 deletions SweetRouterTests/TestRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import XCTest
import SweetRouter

struct Api: RouterType {
struct Api: EndpointType {
enum Environment: EnvironmentType {
case localhost
case test
Expand Down Expand Up @@ -41,7 +41,7 @@ struct Api: RouterType {
static let `default`: Environment = .localhost
}

struct Auth: RouterType {
struct Auth: EndpointType {
enum Route: RouteType {
case signIn, signOut

Expand Down

0 comments on commit 7f5e70d

Please sign in to comment.