Skip to content

Instantly share code, notes, and snippets.

@atom2ueki
Created January 22, 2020 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atom2ueki/4b1dfc0c0f3f5a15145d20c04a78ed0a to your computer and use it in GitHub Desktop.
Save atom2ueki/4b1dfc0c0f3f5a15145d20c04a78ed0a to your computer and use it in GitHub Desktop.
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