-
Notifications
You must be signed in to change notification settings - Fork 0
/
Contents.swift
53 lines (43 loc) · 902 Bytes
/
Contents.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import UIKit
// Bad ISP practice
protocol Payment{
func usemyBTCWallet()
func useCreditCard()
func useCheck()
}
// Good ISP practice
protocol BitcoinPayment{
func usemyBTCWallet()
}
protocol CreditCardPayment{
func useCreditCard()
}
protocol CheckPayment{
func useCheck()
}
class CartUIViewController: Payment{
func usemyBTCWallet() {//functionality
}
func useCreditCard() {//functionality
}
func useCheck() {//functionality
}
func useETHWaller() {
//method not used
}
}
protocol EtheriumPayment{
func usemyETHWallet()
}
protocol BTCPayment: EtheriumPayment{
func usemyBTCWallet()
func usemyBTCLightningAccount()
}
class CartViaCryptoUIViewController: BTCPayment{
func usemyETHWallet() {
}
func usemyBTCLightningAccount() {
}
func usemyBTCWallet() {//functionalit
}
}