Created
January 22, 2020 07:32
-
-
Save atom2ueki/4b1dfc0c0f3f5a15145d20c04a78ed0a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 CommonProtocol { | |
func commonFunc() | |
} | |
protocol ProtocolA: CommonProtocol { | |
func sameName() | |
} | |
protocol ProtocolB: CommonProtocol { | |
func sameName() | |
} | |
class Buyer: ProtocolA { | |
func sameName() { | |
// | |
} | |
func commonFunc() { | |
// | |
} | |
} | |
class Seller: ProtocolB { | |
func sameName() { | |
// | |
} | |
func commonFunc() { | |
// | |
} | |
} | |
class Operation<T> | |
{ | |
var people: T? | |
} | |
extension Operation where T == Buyer | |
{ | |
func buySomething() { | |
// | |
} | |
} | |
extension Operation where T == Seller | |
{ | |
func sellSomething() { | |
// | |
} | |
} | |
class ViewController: UIViewController { | |
var seller: Operation<Seller>? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view. | |
seller?.sellSomething() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment