Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protocol ConnectionServerProtocol {
- func connectWithUsernameAndPassword(username: String, password: String)
- }
- public class ConnectionServer: NSObject {
- var username: String?
- var password: String?
- let connectionServerProtocol: ConnectionServerProtocol
- public init(connectionServerProtocol: ConnectionServerProtocol) {
- self.connectionServerProtocol = connectionServerProtocol
- }
- }
- public func connectWithUsernameAndPassword(username: String, password: String) {
- self.username = username
- self.password = MD5(password)
- self.connectionServerProtocol.dataTask()
- }
- self.connectionServerProtocol.connectWithUsernameAndPassword(username:"someUserName", password: "SomePassword")
- let cs = ConnectionServer()
- let cs = ConnectionServer(connectionServerProtocol:ConnectionServerProtocol)
- let cs = ConnectionServer(connectionServerProtocol: ConnectionServerProtocol.self as! ConnectionServerProtocol)
- let cs = ConnectionServer.self
- cs.connectWithUsernameAndPassword(username: SomeUserName", password:"SomePassword")
- public class ConnectionServer: NSObject, ConnectionServerProtocol {
- }
- cs.connectWithUsernameAndPassword(username: SomeUserName", password:"SomePassword")
Add Comment
Please, Sign In to add comment