Created
September 22, 2017 02:38
-
-
Save kuroyam/384146c1b8ca7391a152677d67b90f4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
protocol GETProtocol { | |
associatedtype GETArguments | |
static func get(_ args: GETArguments) | |
} | |
protocol POSTProtocol { | |
associatedtype POSTArguments | |
static func post(_ args: POSTArguments) | |
} | |
struct Endpoint: GETProtocol, POSTProtocol { | |
typealias GETArguments = Void | |
static func get(_ args: Void) { | |
print("get") | |
} | |
typealias POSTArguments = String | |
static func post(_ args: String) { | |
print("post: \(args)") | |
} | |
} | |
Endpoint.get() // get | |
Endpoint.post("hoge") // post: hoge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment