Skip to content

Commit 9623761

Browse files
committed
apply swiftlint corrections from #117
1 parent 183b5bb commit 9623761

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Sources/CellViewModel.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ extension CellViewModel {
7474
public func eraseToAnyViewModel() -> AnyCellViewModel {
7575
if let erasedViewModel = self as? AnyCellViewModel {
7676
return erasedViewModel
77-
} else {
78-
return AnyCellViewModel(self)
7977
}
78+
return AnyCellViewModel(self)
8079
}
8180

8281
// MARK: Internal
@@ -147,7 +146,7 @@ public struct AnyCellViewModel: CellViewModel {
147146
///
148147
/// - Parameter viewModel: The view model to type-erase.
149148
public init<T: CellViewModel>(_ viewModel: T) {
150-
if let erasedViewModel = viewModel as? AnyCellViewModel {
149+
if let erasedViewModel = viewModel as? Self {
151150
self = erasedViewModel
152151
return
153152
}

Sources/SupplementaryViewModel.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ extension SupplementaryViewModel {
4040
public func eraseToAnyViewModel() -> AnySupplementaryViewModel {
4141
if let erasedViewModel = self as? AnySupplementaryViewModel {
4242
return erasedViewModel
43-
} else {
44-
return AnySupplementaryViewModel(self)
4543
}
44+
return AnySupplementaryViewModel(self)
4645
}
4746

4847
// MARK: Internal
@@ -111,7 +110,7 @@ public struct AnySupplementaryViewModel: SupplementaryViewModel {
111110
///
112111
/// - Parameter viewModel: The view model to type-erase.
113112
public init<T: SupplementaryViewModel>(_ viewModel: T) {
114-
if let erasedViewModel = viewModel as? AnySupplementaryViewModel {
113+
if let erasedViewModel = viewModel as? Self {
115114
self = erasedViewModel
116115
return
117116
}

0 commit comments

Comments
 (0)