From 8eb2ba2fab13d7bdbfade9ed27e88028789614b5 Mon Sep 17 00:00:00 2001 From: Oleksii Dykan Date: Thu, 23 Mar 2017 15:04:53 +0100 Subject: [PATCH 1/2] Rename RouterType protocol to EndpointType protocol --- SweetRouter/Router.swift | 4 ++-- SweetRouterTests/TestRouter.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SweetRouter/Router.swift b/SweetRouter/Router.swift index ddcd9c2..b7d6cb2 100644 --- a/SweetRouter/Router.swift +++ b/SweetRouter/Router.swift @@ -8,7 +8,7 @@ import Foundation -public struct Router: URLRepresentable { +public struct Router: URLRepresentable { public let environment: T.Environment public let route: T.Route @@ -40,7 +40,7 @@ public extension URLRepresentable { } } -public protocol RouterType { +public protocol EndpointType { associatedtype Environment: EnvironmentType associatedtype Route: RouteType diff --git a/SweetRouterTests/TestRouter.swift b/SweetRouterTests/TestRouter.swift index 846a102..57dff10 100644 --- a/SweetRouterTests/TestRouter.swift +++ b/SweetRouterTests/TestRouter.swift @@ -9,7 +9,7 @@ import XCTest import SweetRouter -struct Api: RouterType { +struct Api: EndpointType { enum Environment: EnvironmentType { case localhost case test @@ -41,7 +41,7 @@ struct Api: RouterType { static let `default`: Environment = .localhost } -struct Auth: RouterType { +struct Auth: EndpointType { enum Route: RouteType { case signIn, signOut From c62a0df0a4bbfb4eea7c0c5b0af7714aeb957bf5 Mon Sep 17 00:00:00 2001 From: Oleksii Dykan Date: Thu, 23 Mar 2017 15:07:31 +0100 Subject: [PATCH 2/2] Update README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5338dc3..41c488d 100644 --- a/README.md +++ b/README.md @@ -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 @@ -56,7 +56,7 @@ print(Router(.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