Skip to content
This repository was archived by the owner on Nov 19, 2023. It is now read-only.

Commit 0b6ced7

Browse files
committed
Generic protocols are now default
1 parent 003e34c commit 0b6ced7

3 files changed

Lines changed: 36 additions & 68 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# VIPER interfaces
22

3-
Essential interfaces (protocols) for the VIPER architecture.
3+
Generic interfaces (protocols) for the VIPER architecture.
44

55

66

77
## Installation
88

9-
### SPM
9+
### Swift Package Manager
1010

1111
```
12-
.package(url: "https://github.com/CoreKit/VIPER", from: "2.0.0"),
12+
.package(url: "https://github.com/CoreKit/VIPER", from: "3.0.0"),
1313
```
1414

1515

1616
### CocoaPods
1717

1818
```
1919
source 'https://github.com/CoreKit/VIPER.git'
20-
pod 'VIPER', '~> 2.0.0'
20+
pod 'VIPER', '~> 3.0.0'
2121
```
2222

2323
### Carthage
2424

2525
```
26-
github "CoreKit/VIPER" "2.0.0"
26+
github "CoreKit/VIPER" "3.0.0"
2727
```
2828

2929

Sources/VIPER/Interfaces.swift

Lines changed: 28 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,113 +8,81 @@
88

99
import Foundation
1010

11-
// MARK: - basic viper protocols
11+
// MARK: - interfaces
1212

13-
public protocol ModuleInterface {
14-
15-
}
16-
17-
public protocol RouterInterface: class {
18-
19-
}
20-
21-
public protocol PresenterInterface: class {
22-
23-
}
24-
25-
public protocol InteractorInterface: class {
13+
public protocol RouterPresenterInterface: class {
2614

2715
}
2816

29-
public protocol ViewInterface: class {
17+
public protocol InteractorPresenterInterface: class {
3018

3119
}
3220

33-
public protocol EntityInterface {
21+
public protocol PresenterRouterInterface: class {
3422

3523
}
3624

37-
// MARK: - "i/o" transitions
38-
39-
public protocol RouterPresenterInterface {
25+
public protocol PresenterInteractorInterface: class {
4026

4127
}
4228

43-
public protocol InteractorPresenterInterface {
29+
public protocol PresenterViewInterface: class {
4430

4531
}
4632

47-
public protocol PresenterRouterInterface {
33+
public protocol ViewPresenterInterface: class {
4834

4935
}
5036

51-
public protocol PresenterInteractorInterface {
52-
53-
}
37+
// MARK: - viper
5438

55-
public protocol PresenterViewInterface {
56-
57-
}
58-
59-
public protocol ViewPresenterInterface {
60-
61-
}
62-
63-
// MARK: - generic interfaces
64-
65-
public protocol GenericRouterInterface: RouterInterface &
66-
RouterPresenterInterface {
39+
public protocol RouterInterface: RouterPresenterInterface {
6740
associatedtype PresenterRouter
68-
41+
6942
var presenter: PresenterRouter! { get set }
7043
}
7144

72-
public protocol GenericInteractorInterface: InteractorInterface &
73-
InteractorPresenterInterface {
45+
public protocol InteractorInterface: InteractorPresenterInterface {
7446
associatedtype PresenterInteractor
7547

7648
var presenter: PresenterInteractor! { get set }
7749
}
7850

79-
public protocol GenericPresenterInterface: PresenterInterface &
80-
PresenterRouterInterface &
81-
PresenterInteractorInterface &
82-
PresenterViewInterface
83-
{
51+
public protocol PresenterInterface: PresenterRouterInterface & PresenterInteractorInterface & PresenterViewInterface {
8452
associatedtype RouterPresenter
8553
associatedtype InteractorPresenter
8654
associatedtype ViewPresenter
87-
55+
8856
var router: RouterPresenter! { get set }
8957
var interactor: InteractorPresenter! { get set }
9058
var view: ViewPresenter! { get set }
9159
}
9260

93-
public protocol GenericViewInterface: ViewInterface &
94-
ViewPresenterInterface {
61+
public protocol ViewInterface: ViewPresenterInterface {
9562
associatedtype PresenterView
9663

9764
var presenter: PresenterView! { get set }
9865
}
9966

67+
public protocol EntityInterface {
68+
69+
}
70+
71+
// MARK: - module
72+
73+
public protocol ModuleInterface {
10074

101-
public protocol GenericModuleInterface: ModuleInterface {
102-
associatedtype View where View: GenericViewInterface
103-
associatedtype Presenter where Presenter: GenericPresenterInterface
104-
associatedtype Router where Router: GenericRouterInterface
105-
associatedtype Interactor where Interactor: GenericInteractorInterface
75+
associatedtype View where View: ViewInterface
76+
associatedtype Presenter where Presenter: PresenterInterface
77+
associatedtype Router where Router: RouterInterface
78+
associatedtype Interactor where Interactor: InteractorInterface
10679

107-
func compose(view: View, presenter: Presenter, router: Router, interactor: Interactor)
80+
func assemble(view: View, presenter: Presenter, router: Router, interactor: Interactor)
10881
}
10982

110-
public extension GenericModuleInterface {
83+
public extension ModuleInterface {
11184

112-
/**
113-
Composes the VIPER module
114-
115-
This method will set all the required pointers
116-
*/
117-
func compose(view: View, presenter: Presenter, router: Router, interactor: Interactor) {
85+
func assemble(view: View, presenter: Presenter, router: Router, interactor: Interactor) {
11886
view.presenter = (presenter as! Self.View.PresenterView)
11987

12088
presenter.view = (view as! Self.Presenter.ViewPresenter)

VIPER.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Pod::Spec.new do |s|
22
s.name = 'VIPER'
3-
s.version = '2.0.0'
3+
s.version = '3.0.0'
44
s.summary = 'VIPER interfaces'
55
s.description = <<-DESC
6-
Essential interfaces (protocols) for the VIPER architecture.
6+
Generic interfaces (protocols) for the VIPER architecture.
77
DESC
88

99
s.homepage = 'https://theswiftdev.com/'
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
1212
s.source = { :git => 'https://github.com/CoreKit/VIPER.git', :tag => s.version.to_s }
1313
s.social_media_url = 'https://twitter.com/tiborbodecs'
1414

15-
s.ios.deployment_target = '9.0'
15+
s.ios.deployment_target = '12.0'
1616

1717
s.swift_version = '5.0'
1818
s.source_files = 'Sources/**/*'

0 commit comments

Comments
 (0)