From 5afbc2ffa56d487c2d670ecfd1369c4e8edeca7b Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 11 Jan 2021 23:26:23 +0300 Subject: [PATCH] refactor: update swiftlint to 39.1 --- LeadKit.xcodeproj/project.pbxproj | 4 +- .../xcschemes/LeadKit iOS.xcscheme | 24 +++++------ .../xcschemes/LeadKit tvOS.xcscheme | 24 +++++------ .../BaseCollectionContentController.swift | 4 +- .../BaseCustomViewController.swift | 2 +- .../BaseOrientationController.swift | 2 +- .../BaseScrollContentController.swift | 4 +- .../BaseTableContentController.swift | 6 +-- .../DataLoading/Cursors/FixedPageCursor.swift | 6 +-- .../DataLoading/Cursors/MapCursor.swift | 12 +++--- .../Cursors/SingleLoadCursor.swift | 8 ++-- .../DataLoading/Cursors/StaticCursor.swift | 4 +- .../Cursors/TotalCountCursor.swift | 10 ++--- .../GeneralDataLoadingViewModel.swift | 10 ++--- .../PaginationDataLoadingModel.swift | 6 ++- .../PaginationWrapper.swift | 6 +-- .../DataLoading/RxNetworkOperationModel.swift | 4 +- .../Search/BaseSearchViewController.swift | 12 +++--- .../Classes/Search/BaseSearchViewModel.swift | 16 +++---- Sources/Classes/Services/NetworkService.swift | 42 +++++++++---------- .../BasePlaceholderViewModel.swift | 6 +-- .../BasePlaceholerView.swift | 2 +- .../CustomizableButton.swift | 2 +- .../CustomizableButtonView.swift | 10 ++--- .../CustomizableButtonViewModel.swift | 6 +-- .../Views/EmptyCell/EmptyCellRow.swift | 2 +- .../LabelTableViewCell.swift | 4 +- .../Views/SpinnerView/SpinnerView.swift | 2 +- .../TextField/DataModelFieldBinding.swift | 14 +++---- .../Views/TextField/TextFieldViewModel.swift | 6 +-- Sources/Classes/Views/XibView/XibView.swift | 2 +- .../GeneralDataLoadingState.swift | 10 ++--- .../PaginationDataLoadingState.swift | 10 ++--- .../Alamofire/DataRequest+Extensions.swift | 18 ++++---- .../Alamofire/SessionManager+Extensions.swift | 12 +++--- .../Extensions/Array/Array+Extensions.swift | 2 +- .../Array/Array+RowExtensions.swift | 4 +- .../Array+SeparatorRowBoxExtensions.swift | 2 +- .../Array+TotalCountCursorListingResult.swift | 4 +- .../Codable/Encodable+Extensions.swift | 2 +- .../Comparable/Comparable+Extensions.swift | 4 +- ...pe+RxDataSourceDefaultImplementation.swift | 2 +- .../CursorType/CursorType+Slice.swift | 6 +-- ...DefaultTotalCountCursorListingResult.swift | 8 ++-- ...dingController+DefaultImplementation.swift | 4 +- ...GeneralDataLoadingHandler+Extensions.swift | 2 +- ...neralDataLoadingViewModel+Extensions.swift | 4 +- ...pperUIDelegate+DefaultImplementation.swift | 8 ++-- .../UITableView+PaginationWrappable.swift | 2 +- .../DataLoading/Rx+RxDataSourceProtocol.swift | 4 +- ...mattingService+DefaultImplementation.swift | 14 +++---- .../Extensions/Decimal/Decimal+Values.swift | 4 +- .../CGContext/CGContext+Initializers.swift | 24 +++++------ .../Drawing/CGSize/CGSize+CGContextSize.swift | 2 +- .../Drawing/UIImage/UIImage+Extensions.swift | 18 ++++---- .../Error/Error+NetworkExtensions.swift | 8 ++-- ...oatingPoint+DegreesRadiansConvertion.swift | 4 +- .../UserDefaults/UserDefaults+Codable.swift | 10 ++--- .../NSAttributedString+Extensions.swift | 4 +- ...ildInNumberTypes+NSNumberConvertible.swift | 12 +++--- ...mattingService+DefaultImplementation.swift | 10 ++--- .../Observable+DeferredJust.swift | 2 +- .../ObservableType+Extensions.swift | 6 +-- .../Completable+DeferredJust.swift | 2 +- .../Single/Single+DeferredJust.swift | 2 +- .../Single/Single+Extensions.swift | 6 +-- .../SharedSequence+Extensions.swift | 6 +-- .../Extensions/String/String+Extensions.swift | 2 +- .../String/String+Localization.swift | 2 +- .../TableDirector+Extensions.swift | 4 +- .../TableRow+SeparatorsExtensions.swift | 2 +- .../TableKitViewModel+Extenstions.swift | 2 +- ...ollectionViewHolder+ScrollViewHolder.swift | 2 +- .../TableViewHolder+ScrollViewHolder.swift | 2 +- .../UIButton+ViewTextConfigurable.swift | 10 ++--- ...UIImageView+ExpandCollapseDisclosure.swift | 2 +- .../UILabel+ViewTextConfigurable.swift | 4 +- .../UIScrollView+RxBindings.swift | 2 +- .../UIScrollView+ScrollViewHolder.swift | 2 +- .../UITableView+TableViewHolder.swift | 2 +- .../UITextField+ViewTextConfigurable.swift | 4 +- .../UIKit/UIView/UIView+LoadFromNib.swift | 2 +- .../UIView/UIView+LoadingIndicator.swift | 2 +- .../UIKit/UIView/UIView+XibNameProtocol.swift | 2 +- .../UIViewController+DefaultXibName.swift | 2 +- .../ContentLoadingViewModel+Extensions.swift | 4 +- ...erConfigurable+DefaultImplementation.swift | 2 +- .../CellSeparatorType+Extensions.swift | 4 +- .../SeparatorConfiguration+Extensions.swift | 2 +- .../Views/ViewText/ViewText+Extensions.swift | 6 +-- Sources/Functions/Any+TypeName.swift | 2 +- Sources/Protocols/AlertRepresentable.swift | 2 +- .../Protocols/Drawing/DrawingOperation.swift | 2 +- Sources/Protocols/LoadingIndicator.swift | 2 +- Sources/Protocols/ResettableType.swift | 2 +- Sources/Protocols/SupportProtocol.swift | 4 +- .../AnyPaginationWrappable.swift | 4 +- .../CALayerDrawingOperation.swift | 2 +- .../ImageDrawingOperation.swift | 2 +- .../RotateDrawingOperation.swift | 2 +- .../RoundDrawingOperation.swift | 2 +- .../SolidFillDrawingOperation.swift | 2 +- .../TemplateDrawingOperation.swift | 2 +- .../NetworkServiceConfiguration.swift | 34 +++++++-------- .../Views/AnyLoadingIndicator.swift | 2 +- run_swiftlint.sh | 2 +- 106 files changed, 318 insertions(+), 322 deletions(-) diff --git a/LeadKit.xcodeproj/project.pbxproj b/LeadKit.xcodeproj/project.pbxproj index 0e84aa21..2b864857 100644 --- a/LeadKit.xcodeproj/project.pbxproj +++ b/LeadKit.xcodeproj/project.pbxproj @@ -2296,7 +2296,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1230; ORGANIZATIONNAME = "Touch Instinct"; TargetAttributes = { 67186B271EB248F100CFAFFB = { @@ -3224,6 +3224,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -3283,6 +3284,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; diff --git a/LeadKit.xcodeproj/xcshareddata/xcschemes/LeadKit iOS.xcscheme b/LeadKit.xcodeproj/xcshareddata/xcschemes/LeadKit iOS.xcscheme index 4e71a311..0b788bd9 100644 --- a/LeadKit.xcodeproj/xcshareddata/xcschemes/LeadKit iOS.xcscheme +++ b/LeadKit.xcodeproj/xcshareddata/xcschemes/LeadKit iOS.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -39,17 +48,6 @@ - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - - : BaseScrollContentController { override open func createView() -> CollectionViewWrapperView { - return CollectionViewWrapperView(layout: UICollectionViewFlowLayout()) + CollectionViewWrapperView(layout: UICollectionViewFlowLayout()) } /// Contained UICollectionView instance. public var collectionView: UICollectionView { - return customView.collectionView + customView.collectionView } } diff --git a/Sources/Classes/Controllers/BaseCustomViewController.swift b/Sources/Classes/Controllers/BaseCustomViewController.swift index 02dbfff2..4763a44e 100644 --- a/Sources/Classes/Controllers/BaseCustomViewController.swift +++ b/Sources/Classes/Controllers/BaseCustomViewController.swift @@ -49,6 +49,6 @@ open class BaseCustomViewController: BaseConfigurableCo /// /// - Returns: Initialized custom view. open func createView() -> View { - return View() + View() } } diff --git a/Sources/Classes/Controllers/BaseOrientationController.swift b/Sources/Classes/Controllers/BaseOrientationController.swift index 1b63a347..8c8bc77f 100644 --- a/Sources/Classes/Controllers/BaseOrientationController.swift +++ b/Sources/Classes/Controllers/BaseOrientationController.swift @@ -25,6 +25,6 @@ open class BaseOrientationController: UIViewController { } open override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation { - return forcedInterfaceOrientation ?? super.preferredInterfaceOrientationForPresentation + forcedInterfaceOrientation ?? super.preferredInterfaceOrientationForPresentation } } diff --git a/Sources/Classes/Controllers/BaseScrollContentController.swift b/Sources/Classes/Controllers/BaseScrollContentController.swift index ee8a575c..32b171ce 100644 --- a/Sources/Classes/Controllers/BaseScrollContentController.swift +++ b/Sources/Classes/Controllers/BaseScrollContentController.swift @@ -49,13 +49,13 @@ open class BaseScrollContentController: B /// Contained UIScrollView instance. public var scrollView: UIScrollView { - return customView.scrollView + customView.scrollView } /// Default insets used for contained scroll view. public var defaultInsets: UIEdgeInsets { get { - return defaultInsetsRelay.value + defaultInsetsRelay.value } set { defaultInsetsRelay.accept(newValue) diff --git a/Sources/Classes/Controllers/BaseTableContentController.swift b/Sources/Classes/Controllers/BaseTableContentController.swift index e93457ba..d643f198 100644 --- a/Sources/Classes/Controllers/BaseTableContentController.swift +++ b/Sources/Classes/Controllers/BaseTableContentController.swift @@ -32,11 +32,11 @@ open class BaseTableContentController: BaseScrollContentController TableDirector { - return TableDirector(tableView: tableView) + TableDirector(tableView: tableView) } override open func createView() -> TableViewWrapperView { - return TableViewWrapperView(tableViewStyle: .plain) + TableViewWrapperView(tableViewStyle: .plain) } override open func configureAppearance() { @@ -47,6 +47,6 @@ open class BaseTableContentController: BaseScrollContentController: CursorType, RxDataSource { } public var exhausted: Bool { - return cursor.exhausted && cursor.count == count + cursor.exhausted && cursor.count == count } public private(set) var count: Int = 0 public subscript(index: Int) -> Cursor.Element { - return cursor[index] + cursor[index] } public func loadNextBatch() -> Single<[Cursor.Element]> { - return Single.deferred { + Single.deferred { if self.exhausted { return .error(CursorError.exhausted) } diff --git a/Sources/Classes/DataLoading/Cursors/MapCursor.swift b/Sources/Classes/DataLoading/Cursors/MapCursor.swift index 9dc3838a..30e16dd8 100644 --- a/Sources/Classes/DataLoading/Cursors/MapCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/MapCursor.swift @@ -29,7 +29,7 @@ public extension CursorType { /// - Parameter transform: closure to transform elements /// - Returns: new MapCursor instance func flatMap(transform: @escaping MapCursor.Transform) -> MapCursor { - return MapCursor(cursor: self, transform: transform) + MapCursor(cursor: self, transform: transform) } /// Creates ResettableMapCursor with current cursor @@ -39,7 +39,7 @@ public extension CursorType { func flatMap(transform: @escaping ResettableMapCursor.Transform) -> ResettableMapCursor where Self: ResettableCursorType { - return ResettableMapCursor(cursor: self, transform: transform) + ResettableMapCursor(cursor: self, transform: transform) } } @@ -67,19 +67,19 @@ public class MapCursor: CursorType, RxDataSource { } public var exhausted: Bool { - return cursor.exhausted + cursor.exhausted } public var count: Int { - return elements.count + elements.count } public subscript(index: Int) -> T { - return elements[index] + elements[index] } public func loadNextBatch() -> Single<[T]> { - return cursor.loadNextBatch().map { newItems in + cursor.loadNextBatch().map { newItems in let transformedNewItems = newItems.compactMap(self.transform) self.elements += transformedNewItems diff --git a/Sources/Classes/DataLoading/Cursors/SingleLoadCursor.swift b/Sources/Classes/DataLoading/Cursors/SingleLoadCursor.swift index adeeacf9..c6e76bf8 100644 --- a/Sources/Classes/DataLoading/Cursors/SingleLoadCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/SingleLoadCursor.swift @@ -37,7 +37,7 @@ public final class SingleLoadCursorConfiguration: TotalCountCursorConfi } public func resultSingle() -> Single { - return loadingSingle + loadingSingle } public init(resetFrom other: SingleLoadCursorConfiguration) { @@ -67,15 +67,15 @@ public class SingleLoadCursor: ResettableCursorType { public private(set) var exhausted = false public var count: Int { - return content.count + content.count } public subscript(index: Int) -> Element { - return content[index] + content[index] } public func loadNextBatch() -> Single<[Element]> { - return Single.deferred { + Single.deferred { if self.exhausted { return .error(CursorError.exhausted) } diff --git a/Sources/Classes/DataLoading/Cursors/StaticCursor.swift b/Sources/Classes/DataLoading/Cursors/StaticCursor.swift index 5daa54e3..a1a48fb9 100644 --- a/Sources/Classes/DataLoading/Cursors/StaticCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/StaticCursor.swift @@ -45,11 +45,11 @@ public class StaticCursor: ResettableRxDataSourceCursor { public private(set) var count = 0 public subscript(index: Int) -> Element { - return content[index] + content[index] } public func loadNextBatch() -> Single<[Element]> { - return Single.deferred { + Single.deferred { if self.exhausted { return .error(CursorError.exhausted) } diff --git a/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift b/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift index c40393f0..12d22f8a 100644 --- a/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift @@ -35,15 +35,15 @@ open class TotalCountCursor: public private(set) var totalCount: Int = .max public var exhausted: Bool { - return count >= totalCount + count >= totalCount } public var count: Int { - return elements.count + elements.count } public subscript(index: Int) -> Element { - return elements[index] + elements[index] } public init(configuration: CursorConfiguration) { @@ -55,11 +55,11 @@ open class TotalCountCursor: } open func processResultFromConfigurationSingle() -> Single { - return configuration.resultSingle() + configuration.resultSingle() } public func loadNextBatch() -> Single<[Element]> { - return processResultFromConfigurationSingle() + processResultFromConfigurationSingle() .do(onSuccess: { [weak self] listingResult in self?.totalCount = listingResult.totalCount self?.elements = (self?.elements ?? []) + listingResult.results diff --git a/Sources/Classes/DataLoading/GeneralDataLoading/GeneralDataLoadingViewModel.swift b/Sources/Classes/DataLoading/GeneralDataLoading/GeneralDataLoadingViewModel.swift index 63e1ce1b..43c6415d 100644 --- a/Sources/Classes/DataLoading/GeneralDataLoading/GeneralDataLoadingViewModel.swift +++ b/Sources/Classes/DataLoading/GeneralDataLoading/GeneralDataLoadingViewModel.swift @@ -63,28 +63,28 @@ open class GeneralDataLoadingViewModel: BaseViewModel, GeneralDataLo /// Returns observable that emits current loading state. open var loadingStateObservable: Observable { - return loadingStateRelay.asObservable() + loadingStateRelay.asObservable() } /// Returns driver that emits current loading state. open var loadingStateDriver: Driver { - return loadingStateRelay.asDriver() + loadingStateRelay.asDriver() } /// By default returns true if loading state == .result. open var hasContent: Bool { - return currentLoadingState.hasResult + currentLoadingState.hasResult } /// Returns current result if it exists. public var currentResult: ResultType? { - return currentLoadingState.result + currentLoadingState.result } /// Current state of loading process. private(set) public var currentLoadingState: LoadingState { get { - return loadingStateRelay.value + loadingStateRelay.value } set { loadingStateRelay.accept(newValue) diff --git a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationDataLoadingModel.swift b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationDataLoadingModel.swift index a74d00e7..4d8462e1 100644 --- a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationDataLoadingModel.swift +++ b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationDataLoadingModel.swift @@ -22,9 +22,11 @@ import RxSwift +public typealias RxPaginationDataLoadingModel = + RxDataLoadingModel> + /// Data loading model for PaginationDataLoadingState with ResettableRxDataSourceCursor as data source. -public final class PaginationDataLoadingModel: - RxDataLoadingModel> { +public final class PaginationDataLoadingModel: RxPaginationDataLoadingModel { private enum LoadType { diff --git a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift index c58bee3f..93b75a6c 100644 --- a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift +++ b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift @@ -43,7 +43,7 @@ final public class PaginationWrapper { - return Binder(self) { base, value in + Binder(self) { base, value in switch value { case .initial: base.onInitialState() @@ -354,7 +354,7 @@ private extension PaginationWrapper { } var scrollOffsetChanged: Binder { - return Binder(self) { base, value in + Binder(self) { base, value in base.currentPlaceholderViewTopConstraint?.constant = -value.y } } diff --git a/Sources/Classes/DataLoading/RxNetworkOperationModel.swift b/Sources/Classes/DataLoading/RxNetworkOperationModel.swift index f5d5d0fe..4867dc1b 100644 --- a/Sources/Classes/DataLoading/RxNetworkOperationModel.swift +++ b/Sources/Classes/DataLoading/RxNetworkOperationModel.swift @@ -39,7 +39,7 @@ open class RxNetworkOperationModel: Net private let errorHandler: ErrorHandler open var stateDriver: Driver { - return stateRelay.asDriver() + stateRelay.asDriver() } /// Model initializer with data source and custom error handler. @@ -91,7 +91,7 @@ open class RxNetworkOperationModel: Net var state: LoadingStateType { get { - return stateRelay.value + stateRelay.value } set { stateRelay.accept(newValue) diff --git a/Sources/Classes/Search/BaseSearchViewController.swift b/Sources/Classes/Search/BaseSearchViewController.swift index f4bbe615..bc2cab11 100644 --- a/Sources/Classes/Search/BaseSearchViewController.swift +++ b/Sources/Classes/Search/BaseSearchViewController.swift @@ -114,11 +114,11 @@ where ViewModel: BaseSearchViewModel { } open var searchBarPlaceholder: String { - return "" + "" } open var searchBarColor: UIColor { - return .gray + .gray } open var statusBarView: UIView { @@ -133,7 +133,7 @@ where ViewModel: BaseSearchViewModel { } open var statusBarColor: UIColor { - return .black + .black } open func updateContent(with viewModels: [ItemViewModel]) { @@ -146,16 +146,16 @@ where ViewModel: BaseSearchViewModel { } open var resetResults: Observable { - return searchController.rx.willPresent + searchController.rx.willPresent .map { SearchResultsViewControllerState.initial } } open var searchResults: Observable { - return viewModel.searchResultsDriver + viewModel.searchResultsDriver .asObservable() .withUnretained(self) .map { owner, viewModels -> SearchResultsViewControllerState in - owner.stateForUpdate(with: viewModels) ?? .rowsContent(rows: []) + owner.stateForUpdate(with: viewModels) } } diff --git a/Sources/Classes/Search/BaseSearchViewModel.swift b/Sources/Classes/Search/BaseSearchViewModel.swift index 6c0edf7d..224f4ed9 100644 --- a/Sources/Classes/Search/BaseSearchViewModel.swift +++ b/Sources/Classes/Search/BaseSearchViewModel.swift @@ -35,7 +35,7 @@ open class BaseSearchViewModel: GeneralDataLoadingViewModel } open var itemsViewModelsDriver: Driver<[ItemViewModel]> { - return loadingResultObservable + loadingResultObservable .withUnretained(self) .map { owner, items in owner.viewModels(from: items) @@ -46,11 +46,11 @@ open class BaseSearchViewModel: GeneralDataLoadingViewModel } open var searchDebounceInterval: RxTimeInterval { - return .seconds(1) + .seconds(1) } open var searchResultsDriver: Driver<[ItemViewModel]> { - return searchTextRelay.debounce(searchDebounceInterval, scheduler: MainScheduler.instance) + searchTextRelay.debounce(searchDebounceInterval, scheduler: MainScheduler.instance) .withLatestFrom(loadingResultObservable) { ($0, $1) } .flatMapLatest { [weak self] searchText, items -> Observable in self?.search(by: searchText, from: items).asObservable() ?? .empty() @@ -73,29 +73,29 @@ open class BaseSearchViewModel: GeneralDataLoadingViewModel } open func bind(searchText: Observable) -> Disposable { - return searchText.bind(to: searchTextRelay) + searchText.bind(to: searchTextRelay) } private func viewModels(from items: ItemsList) -> [ItemViewModel] { - return items.map { self.viewModel(from: $0) } + items.map { self.viewModel(from: $0) } } open var loadingResultObservable: Observable { - return loadingStateDriver + loadingStateDriver .asObservable() .map { $0.result } .flatMap { Observable.from(optional: $0) } } open var loadingErrorObservable: Observable { - return loadingStateDriver + loadingStateDriver .asObservable() .map { $0.error } .flatMap { Observable.from(optional: $0) } } open var firstLoadingResultObservable: Single { - return loadingResultObservable + loadingResultObservable .take(1) .asSingle() } diff --git a/Sources/Classes/Services/NetworkService.swift b/Sources/Classes/Services/NetworkService.swift index cd36c7b5..3c3115fa 100644 --- a/Sources/Classes/Services/NetworkService.swift +++ b/Sources/Classes/Services/NetworkService.swift @@ -39,7 +39,7 @@ open class NetworkService { /// Driver that emits true when active requests count != 0 and false otherwise. public var isActivityIndicatorVisibleDriver: Driver { - return requestCountRelay.asDriver().map { $0 != 0 }.distinctUntilChanged() + requestCountRelay.asDriver().map { $0 != 0 }.distinctUntilChanged() } /// - Parameter sessionManager: Alamofire.SessionManager to use for requests @@ -63,12 +63,12 @@ open class NetworkService { public func rxObservableRequest(with parameters: ApiRequestParameters, additionalValidStatusCodes: Set = [], decoder: JSONDecoder = JSONDecoder()) - -> Observable> { + -> Observable> { - return sessionManager.rx.responseObservableModel(requestParameters: parameters, - additionalValidStatusCodes: additionalValidStatusCodes, - decoder: decoder) - .counterTracking(for: self) + sessionManager.rx.responseObservableModel(requestParameters: parameters, + additionalValidStatusCodes: additionalValidStatusCodes, + decoder: decoder) + .counterTracking(for: self) } /// Perform reactive request to get mapped ImmutableMappable model and http response @@ -81,12 +81,12 @@ open class NetworkService { public func rxRequest(with parameters: ApiRequestParameters, additionalValidStatusCodes: Set = [], decoder: JSONDecoder = JSONDecoder()) - -> Observable> { + -> Observable> { - return sessionManager.rx.responseModel(requestParameters: parameters, - additionalValidStatusCodes: additionalValidStatusCodes, - decoder: decoder) - .counterTracking(for: self) + sessionManager.rx.responseModel(requestParameters: parameters, + additionalValidStatusCodes: additionalValidStatusCodes, + decoder: decoder) + .counterTracking(for: self) } /// Perform reactive request to get data and http response @@ -96,11 +96,11 @@ open class NetworkService { /// - additionalValidStatusCodes: set of additional valid status codes /// - Returns: Observable of tuple containing (HTTPURLResponse, Data) public func rxDataRequest(with parameters: ApiRequestParameters, additionalValidStatusCodes: Set = []) - -> Observable { + -> Observable { - return sessionManager.rx.responseData(requestParameters: parameters, - additionalValidStatusCodes: additionalValidStatusCodes) - .counterTracking(for: self) + sessionManager.rx.responseData(requestParameters: parameters, + additionalValidStatusCodes: additionalValidStatusCodes) + .counterTracking(for: self) } /// Perform reactive request to upload data and get Observable model and http response @@ -113,12 +113,12 @@ open class NetworkService { public func rxUploadRequest(with parameters: ApiUploadRequestParameters, additionalValidStatusCodes: Set = [], decoder: JSONDecoder = JSONDecoder()) - -> Observable> { + -> Observable> { - return sessionManager.rx.uploadResponseModel(requestParameters: parameters, - additionalValidStatusCodes: additionalValidStatusCodes, - decoder: decoder) - .counterTracking(for: self) + sessionManager.rx.uploadResponseModel(requestParameters: parameters, + additionalValidStatusCodes: additionalValidStatusCodes, + decoder: decoder) + .counterTracking(for: self) } } @@ -145,7 +145,7 @@ public extension Observable { /// - Parameter networkService: NetworkService to operate on it /// - Returns: The source sequence with the side-effecting behavior applied. func counterTracking(for networkService: NetworkService) -> Observable { - return `do`(onSubscribe: { + `do`(onSubscribe: { networkService.increaseRequestCounter() }, onDispose: { networkService.decreaseRequestCounter() diff --git a/Sources/Classes/Views/BasePlaceholderView/BasePlaceholderViewModel.swift b/Sources/Classes/Views/BasePlaceholderView/BasePlaceholderViewModel.swift index 584a8cfe..b566da6e 100644 --- a/Sources/Classes/Views/BasePlaceholderView/BasePlaceholderViewModel.swift +++ b/Sources/Classes/Views/BasePlaceholderView/BasePlaceholderViewModel.swift @@ -62,16 +62,16 @@ public extension BasePlaceholderViewModel { /// Returns true if description is not nil. var hasDescription: Bool { - return description != nil + description != nil } /// Returns true buttonTitle is not nil. var hasButton: Bool { - return buttonTitle != nil + buttonTitle != nil } /// Returns true if centerImage is not nil. var hasCenterImage: Bool { - return centerImage != nil + centerImage != nil } } diff --git a/Sources/Classes/Views/BasePlaceholderView/BasePlaceholerView.swift b/Sources/Classes/Views/BasePlaceholderView/BasePlaceholerView.swift index 7687e1b3..a6fd0af7 100644 --- a/Sources/Classes/Views/BasePlaceholderView/BasePlaceholerView.swift +++ b/Sources/Classes/Views/BasePlaceholderView/BasePlaceholerView.swift @@ -55,7 +55,7 @@ open class BasePlaceholderView: ButtonHolderView, InitializableView { /// /// - Returns: UIButton (sub)class. open func createButton() -> UIButton { - return UIButton() + UIButton() } // MARK: - InitializableView diff --git a/Sources/Classes/Views/CustomizableButton/CustomizableButton.swift b/Sources/Classes/Views/CustomizableButton/CustomizableButton.swift index 6c3b9db7..6e5919c3 100644 --- a/Sources/Classes/Views/CustomizableButton/CustomizableButton.swift +++ b/Sources/Classes/Views/CustomizableButton/CustomizableButton.swift @@ -48,7 +48,7 @@ open class CustomizableButton: UIButton { } func backgroundColor(for state: UIControl.State) -> UIColor? { - return backgroundColors[state] + backgroundColors[state] } private func updateBackgroundColor() { diff --git a/Sources/Classes/Views/CustomizableButton/CustomizableButtonView.swift b/Sources/Classes/Views/CustomizableButton/CustomizableButtonView.swift index e777815a..05f11b71 100644 --- a/Sources/Classes/Views/CustomizableButton/CustomizableButtonView.swift +++ b/Sources/Classes/Views/CustomizableButton/CustomizableButtonView.swift @@ -45,7 +45,7 @@ public struct CustomizableButtonState: OptionSet { // MARK: - Properties public var isLoading: Bool { - return contains(.loading) + contains(.loading) } } @@ -99,15 +99,15 @@ open class CustomizableButtonView: UIView, InitializableView, ConfigurableView { // MARK: - Computed Properties public var tapObservable: Observable { - return button.rx.tap.asObservable() + button.rx.tap.asObservable() } override open var forFirstBaselineLayout: UIView { - return button.forFirstBaselineLayout + button.forFirstBaselineLayout } override open var forLastBaselineLayout: UIView { - return button.forLastBaselineLayout + button.forLastBaselineLayout } override open func touchesBegan(_ touches: Set, with event: UIEvent?) { @@ -255,7 +255,7 @@ open class CustomizableButtonView: UIView, InitializableView, ConfigurableView { } private var stateBinder: Binder { - return Binder(self) { base, value in + Binder(self) { base, value in base.configureButton(withState: value) base.onStateChange(value) } diff --git a/Sources/Classes/Views/CustomizableButton/CustomizableButtonViewModel.swift b/Sources/Classes/Views/CustomizableButton/CustomizableButtonViewModel.swift index b96d137f..f1422127 100644 --- a/Sources/Classes/Views/CustomizableButton/CustomizableButtonViewModel.swift +++ b/Sources/Classes/Views/CustomizableButton/CustomizableButtonViewModel.swift @@ -39,15 +39,15 @@ open class CustomizableButtonViewModel { } open var stateDriver: Driver { - return stateRelay.asDriver() + stateRelay.asDriver() } func bind(tapObservable: Observable) -> Disposable { - return tapObservable.bind(to: tapRelay) + tapObservable.bind(to: tapRelay) } public var tapDriver: Driver { - return tapRelay.asDriver() + tapRelay.asDriver() } public func updateState(with newState: CustomizableButtonState) { diff --git a/Sources/Classes/Views/EmptyCell/EmptyCellRow.swift b/Sources/Classes/Views/EmptyCell/EmptyCellRow.swift index 05054e61..1a2cf628 100644 --- a/Sources/Classes/Views/EmptyCell/EmptyCellRow.swift +++ b/Sources/Classes/Views/EmptyCell/EmptyCellRow.swift @@ -48,6 +48,6 @@ public final class EmptyCellRow: TableRow { /// Used for set custom height to each cell, not for each cell type override public var defaultHeight: CGFloat? { - return rowHeight + rowHeight } } diff --git a/Sources/Classes/Views/LabelTableViewCell/LabelTableViewCell.swift b/Sources/Classes/Views/LabelTableViewCell/LabelTableViewCell.swift index 53e2db86..29304ebd 100644 --- a/Sources/Classes/Views/LabelTableViewCell/LabelTableViewCell.swift +++ b/Sources/Classes/Views/LabelTableViewCell/LabelTableViewCell.swift @@ -93,11 +93,11 @@ open class LabelTableViewCell: SeparatorCell, InitializableView, ConfigurableCel // MARK: - Private private var labelInsets: UIEdgeInsets { - return viewModel?.labelInsets ?? .zero + viewModel?.labelInsets ?? .zero } private var contentInsets: UIEdgeInsets { - return viewModel?.contentInsets ?? .zero + viewModel?.contentInsets ?? .zero } // MARK: - Subclass methods to override diff --git a/Sources/Classes/Views/SpinnerView/SpinnerView.swift b/Sources/Classes/Views/SpinnerView/SpinnerView.swift index 9601a50b..a8dbd5ee 100644 --- a/Sources/Classes/Views/SpinnerView/SpinnerView.swift +++ b/Sources/Classes/Views/SpinnerView/SpinnerView.swift @@ -25,7 +25,7 @@ import UIKit public final class SpinnerView: UIView, Animatable, LoadingIndicator { private var animating: Bool { - return imageView?.layer.animation(forKey: CABasicAnimation.rotationKeyPath) != nil + imageView?.layer.animation(forKey: CABasicAnimation.rotationKeyPath) != nil } private var startTime = CFTimeInterval(0) diff --git a/Sources/Classes/Views/TextField/DataModelFieldBinding.swift b/Sources/Classes/Views/TextField/DataModelFieldBinding.swift index 53ea5cbc..9618e434 100644 --- a/Sources/Classes/Views/TextField/DataModelFieldBinding.swift +++ b/Sources/Classes/Views/TextField/DataModelFieldBinding.swift @@ -57,7 +57,7 @@ public final class DataModelFieldBinding { /// - Parameter textDriver: Driver that emits new text values. /// - Returns: Disposable object that can be used to unsubscribe the observer from the behaviour relay. public func mergeStringToModel(from textDriver: Driver) -> Disposable { - return textDriver.map { [modelRelay, mergeFieldClosure] in + textDriver.map { [modelRelay, mergeFieldClosure] in mergeFieldClosure(modelRelay.value, $0) } .drive(modelRelay) @@ -65,7 +65,7 @@ public final class DataModelFieldBinding { /// A Driver that will emit current field value. public var fieldDriver: Driver { - return modelDriver.map(getFieldClosure) + modelDriver.map(getFieldClosure) } } @@ -111,11 +111,11 @@ public extension BehaviorRelay { /// - Returns: DataModelFieldBinding instance. func fieldBinding(getFieldClosure: @escaping DataModelFieldBinding.GetFieldClosure, mergeFieldClosure: @escaping DataModelFieldBinding.MergeFieldClosure) - -> DataModelFieldBinding { + -> DataModelFieldBinding { - return DataModelFieldBinding(modelRelay: self, - getFieldClosure: getFieldClosure, - mergeFieldClosure: mergeFieldClosure) + DataModelFieldBinding(modelRelay: self, + getFieldClosure: getFieldClosure, + mergeFieldClosure: mergeFieldClosure) } } @@ -125,6 +125,6 @@ public extension BehaviorRelay where Element == String? { /// /// - Returns: DataModelFieldBinding instance. func fieldBinding() -> DataModelFieldBinding { - return DataModelFieldBinding(modelRelay: self) + DataModelFieldBinding(modelRelay: self) } } diff --git a/Sources/Classes/Views/TextField/TextFieldViewModel.swift b/Sources/Classes/Views/TextField/TextFieldViewModel.swift index 1479415b..6e8cd348 100644 --- a/Sources/Classes/Views/TextField/TextFieldViewModel.swift +++ b/Sources/Classes/Views/TextField/TextFieldViewModel.swift @@ -44,7 +44,7 @@ open class TextFieldViewModel < ViewEvents: TextFieldViewEvents, /// View events driver that will emit view events structure /// when view will bind itself to the view model. public var viewEventsDriver: Driver { - return viewEventsRelay + viewEventsRelay .asDriver() .flatMap { viewEvents -> Driver in guard let viewEvents = viewEvents else { @@ -77,7 +77,7 @@ public extension TextFieldViewModel { /// - Parameter closure: Closure that takes a view events parameter and returns Disposable. /// - Returns: Disposable object that can be used to unsubscribe the observer from the binding. func mapViewEvents(_ closure: @escaping MapViewEventClosure) -> Disposable { - return mapViewEvents { [closure($0)] } + mapViewEvents { [closure($0)] } } typealias MapViewEventsClosure = (ViewEvents) -> [Disposable] @@ -87,7 +87,7 @@ public extension TextFieldViewModel { /// - Parameter closure: Closure that takes a view events parameter and returns [Disposable]. /// - Returns: Disposable object that can be used to unsubscribe the observer from the binding. func mapViewEvents(_ closure: @escaping MapViewEventsClosure) -> Disposable { - return viewEventsDriver + viewEventsDriver .map { [weak self] in guard let strongSelf = self else { return diff --git a/Sources/Classes/Views/XibView/XibView.swift b/Sources/Classes/Views/XibView/XibView.swift index 08b4c2ef..733d1b47 100644 --- a/Sources/Classes/Views/XibView/XibView.swift +++ b/Sources/Classes/Views/XibView/XibView.swift @@ -28,7 +28,7 @@ open class XibView: UIView { /// Nib name used to instantiate inner view /// - NOTE: Be very carefully when you're intending to change this line open var innerViewNibName: String { - return typeName(of: type(of: self)) + typeName(of: type(of: self)) } public convenience init() { diff --git a/Sources/Enums/DataLoading/GeneralDataLoading/GeneralDataLoadingState.swift b/Sources/Enums/DataLoading/GeneralDataLoading/GeneralDataLoadingState.swift index aca61676..fe1faab3 100644 --- a/Sources/Enums/DataLoading/GeneralDataLoading/GeneralDataLoadingState.swift +++ b/Sources/Enums/DataLoading/GeneralDataLoading/GeneralDataLoadingState.swift @@ -41,28 +41,28 @@ extension GeneralDataLoadingState: DataLoadingState { public typealias DataSourceType = DS public static var initialState: GeneralDataLoadingState { - return .initial + .initial } public static var emptyState: GeneralDataLoadingState { - return .empty + .empty } public static func initialLoadingState(after: GeneralDataLoadingState) -> GeneralDataLoadingState { - return .loading + .loading } public static func resultState(result: DS.ResultType, from: DS, after: GeneralDataLoadingState) -> GeneralDataLoadingState { - return .result(newResult: result, from: from) + .result(newResult: result, from: from) } public static func errorState(error: Error, after: GeneralDataLoadingState) -> GeneralDataLoadingState { - return .error(error: error) + .error(error: error) } public var isInitialState: Bool { diff --git a/Sources/Enums/DataLoading/PaginationDataLoading/PaginationDataLoadingState.swift b/Sources/Enums/DataLoading/PaginationDataLoading/PaginationDataLoadingState.swift index 2ddf9464..3ee39cac 100644 --- a/Sources/Enums/DataLoading/PaginationDataLoading/PaginationDataLoadingState.swift +++ b/Sources/Enums/DataLoading/PaginationDataLoading/PaginationDataLoadingState.swift @@ -45,28 +45,28 @@ extension PaginationDataLoadingState: DataLoadingState { public typealias DataSourceType = DS public static var initialState: PaginationDataLoadingState { - return .initial + .initial } public static var emptyState: PaginationDataLoadingState { - return .empty + .empty } public static func initialLoadingState(after: PaginationDataLoadingState) -> PaginationDataLoadingState { - return .initialLoading(after: after) + .initialLoading(after: after) } public static func resultState(result: DS.ResultType, from: DataSourceType, after: PaginationDataLoadingState) -> PaginationDataLoadingState { - return .results(newItems: result, from: from, after: after) + .results(newItems: result, from: from, after: after) } public static func errorState(error: Error, after: PaginationDataLoadingState) -> PaginationDataLoadingState { - return .error(error: error, after: after) + .error(error: error, after: after) } public var isInitialState: Bool { diff --git a/Sources/Extensions/Alamofire/DataRequest+Extensions.swift b/Sources/Extensions/Alamofire/DataRequest+Extensions.swift index 90bc6da8..2cefbc8b 100644 --- a/Sources/Extensions/Alamofire/DataRequest+Extensions.swift +++ b/Sources/Extensions/Alamofire/DataRequest+Extensions.swift @@ -36,7 +36,7 @@ public extension Reactive where Base: DataRequest { func apiResponse(mappingQueue: DispatchQueue = .global(), decoder: JSONDecoder) -> Observable> { - return response(onQueue: mappingQueue) + response(onQueue: mappingQueue) .tryMapResult { response, data in (response, try decoder.decode(T.self, from: data)) } @@ -50,7 +50,7 @@ public extension Reactive where Base: DataRequest { func observableApiResponse(mappingQueue: DispatchQueue = .global(), decoder: JSONDecoder) -> Observable> { - return response(onQueue: mappingQueue) + response(onQueue: mappingQueue) .tryMapObservableResult { response, value in let json = try JSONSerialization.jsonObject(with: value, options: []) return T.create(from: json, with: decoder) @@ -64,13 +64,13 @@ public extension Reactive where Base: DataRequest { /// - Parameter mappingQueue: The dispatch queue to use for mapping /// - Returns: Observable with HTTP URL Response and data func dataApiResponse(mappingQueue: DispatchQueue) -> Observable { - return response(onQueue: mappingQueue) + response(onQueue: mappingQueue) .map { $0 as SessionManager.DataResponse } .catchAsRequestError(with: self.base) } private func response(onQueue queue: DispatchQueue) -> Observable<(HTTPURLResponse, Data)> { - return responseResult(queue: queue, responseSerializer: DataResponseSerializer()) + responseResult(queue: queue, responseSerializer: DataResponseSerializer()) } } @@ -81,7 +81,7 @@ public extension ObservableType where Element == DataRequest { /// - Parameter statusCodes: set of status codes to validate /// - Returns: Observable on self func validate(statusCodes: Set) -> Observable { - return map { $0.validate(statusCode: statusCodes) } + map { $0.validate(statusCode: statusCodes) } .catchAsRequestError() } } @@ -89,7 +89,7 @@ public extension ObservableType where Element == DataRequest { private extension ObservableType where Element == ServerResponse { func tryMapResult(_ transform: @escaping (Element) throws -> R) -> Observable { - return map { + map { do { return try transform($0) } catch { @@ -99,10 +99,10 @@ private extension ObservableType where Element == ServerResponse { } func tryMapObservableResult(_ transform: @escaping (Element) throws -> Observable) -> Observable { - return flatMap { response, result -> Observable in + flatMap { response, result -> Observable in do { return try transform((response, result)) - .catchError { + .catch { throw RequestError.mapping(error: $0, response: result) } } catch { @@ -115,7 +115,7 @@ private extension ObservableType where Element == ServerResponse { private extension ObservableType { func catchAsRequestError(with request: DataRequest? = nil) -> Observable { - return catchError { error in + self.catch { error in let resultError: RequestError let response = request?.data diff --git a/Sources/Extensions/Alamofire/SessionManager+Extensions.swift b/Sources/Extensions/Alamofire/SessionManager+Extensions.swift index fcaa7f86..77075a92 100644 --- a/Sources/Extensions/Alamofire/SessionManager+Extensions.swift +++ b/Sources/Extensions/Alamofire/SessionManager+Extensions.swift @@ -53,7 +53,7 @@ public extension Reactive where Base: SessionManager { headers: HTTPHeaders? = nil) -> Observable { - return Observable.deferred { + Observable.deferred { guard method != .get else { assertionFailure("Unable to pass array in get request") @@ -74,7 +74,7 @@ public extension Reactive where Base: SessionManager { /// - additionalValidStatusCodes: set of additional valid status codes /// - Returns: Observable with request func apiRequest(requestParameters: ApiRequestParameters, additionalValidStatusCodes: Set) -> Observable { - return .deferred { + .deferred { var url = try requestParameters.url.asURL() if let queryItems = requestParameters.queryItems { @@ -133,7 +133,7 @@ public extension Reactive where Base: SessionManager { decoder: JSONDecoder) -> Observable> { - return apiRequest(requestParameters: requestParameters, additionalValidStatusCodes: additionalValidStatusCodes) + apiRequest(requestParameters: requestParameters, additionalValidStatusCodes: additionalValidStatusCodes) .flatMap { $0.rx.apiResponse(mappingQueue: self.base.mappingQueue, decoder: decoder) } @@ -151,7 +151,7 @@ public extension Reactive where Base: SessionManager { decoder: JSONDecoder) -> Observable> { - return apiRequest(requestParameters: requestParameters, additionalValidStatusCodes: additionalValidStatusCodes) + apiRequest(requestParameters: requestParameters, additionalValidStatusCodes: additionalValidStatusCodes) .flatMap { $0.rx.observableApiResponse(mappingQueue: self.base.mappingQueue, decoder: decoder) } @@ -166,7 +166,7 @@ public extension Reactive where Base: SessionManager { func responseData(requestParameters: ApiRequestParameters, additionalValidStatusCodes: Set) -> Observable { - return apiRequest(requestParameters: requestParameters, additionalValidStatusCodes: additionalValidStatusCodes) + apiRequest(requestParameters: requestParameters, additionalValidStatusCodes: additionalValidStatusCodes) .flatMap { $0.rx.dataApiResponse(mappingQueue: self.base.mappingQueue) } @@ -184,7 +184,7 @@ public extension Reactive where Base: SessionManager { decoder: JSONDecoder) -> Observable> { - return Observable.deferred { + Observable.deferred { let urlRequest = try URLRequest(url: requestParameters.url, method: .post, headers: requestParameters.headers) let data = try requestParameters.formData.encode() diff --git a/Sources/Extensions/Array/Array+Extensions.swift b/Sources/Extensions/Array/Array+Extensions.swift index 5dfe6b7a..a19d803e 100644 --- a/Sources/Extensions/Array/Array+Extensions.swift +++ b/Sources/Extensions/Array/Array+Extensions.swift @@ -69,6 +69,6 @@ public extension Array { // Subscript for safe access to element by index subscript(safe index: Index) -> Element? { - return (index < count && index >= 0) ? self[index] : nil + (index < count && index >= 0) ? self[index] : nil } } diff --git a/Sources/Extensions/Array/Array+RowExtensions.swift b/Sources/Extensions/Array/Array+RowExtensions.swift index 222acb45..d64c76c7 100644 --- a/Sources/Extensions/Array/Array+RowExtensions.swift +++ b/Sources/Extensions/Array/Array+RowExtensions.swift @@ -26,11 +26,11 @@ public extension Array where Element: TableKitViewModel { /// Creates [Row] array from TableKitViewModels. var tableRows: [Row] { - return map { $0.tableRow } + map { $0.tableRow } } /// Creates TableSection with empty, zero height header and footer. var onlyRowsSection: TableSection { - return TableSection(onlyRows: tableRows) + TableSection(onlyRows: tableRows) } } diff --git a/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift b/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift index 04cdc849..38421af5 100644 --- a/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift +++ b/Sources/Extensions/Array/Array+SeparatorRowBoxExtensions.swift @@ -26,7 +26,7 @@ public extension Array where Element == SeparatorRowBox { /// Create rows from SeparatorRowBox array var rows: [Row] { - return map { $0.row } + map { $0.row } } /// Configure separators from SeparatorRowBox array diff --git a/Sources/Extensions/Array/Array+TotalCountCursorListingResult.swift b/Sources/Extensions/Array/Array+TotalCountCursorListingResult.swift index 87a3dfbb..0189e9d0 100644 --- a/Sources/Extensions/Array/Array+TotalCountCursorListingResult.swift +++ b/Sources/Extensions/Array/Array+TotalCountCursorListingResult.swift @@ -25,10 +25,10 @@ extension Array: TotalCountCursorListingResult { public typealias ElementType = Element public var results: [Element] { - return self + self } public var totalCount: Int { - return count + count } } diff --git a/Sources/Extensions/Codable/Encodable+Extensions.swift b/Sources/Extensions/Codable/Encodable+Extensions.swift index fe8869de..44254b19 100644 --- a/Sources/Extensions/Codable/Encodable+Extensions.swift +++ b/Sources/Extensions/Codable/Encodable+Extensions.swift @@ -39,7 +39,7 @@ public extension Encodable { /// Method that converts encodable model to URLQueryItems array /// - Returns: URLQueryItems array func asUrlQueryItems() throws -> [URLQueryItem] { - return try toJSON().map { + try toJSON().map { if ($1 is [String: Any] || $1 is [Any]), let jsonData = try? JSONSerialization.data(withJSONObject: $1, options: []), let jsonString = String(data: jsonData, encoding: .utf8) { diff --git a/Sources/Extensions/Comparable/Comparable+Extensions.swift b/Sources/Extensions/Comparable/Comparable+Extensions.swift index b638fee4..303966f3 100644 --- a/Sources/Extensions/Comparable/Comparable+Extensions.swift +++ b/Sources/Extensions/Comparable/Comparable+Extensions.swift @@ -28,13 +28,13 @@ public extension Comparable { /// - parameter bounds: Lower and uppper bounds tuple /// - returns: Current value if it fits range, otherwise lower if value is too small or upper if value is too big func `in`(bounds: (lower: Self, upper: Self)) -> Self { - return min(max(bounds.lower, self), bounds.upper) + min(max(bounds.lower, self), bounds.upper) } /// Use this function to restrict comparable with lower and upper values /// - parameter range: ClosedRange representing bounds /// - returns: Current value if it fits range, otherwise lower if value is too small or upper if value is too big func `in`(range: ClosedRange) -> Self { - return `in`(bounds: (lower: range.lowerBound, upper: range.upperBound)) + `in`(bounds: (lower: range.lowerBound, upper: range.upperBound)) } } diff --git a/Sources/Extensions/DataLoading/CursorType/CursorType+RxDataSourceDefaultImplementation.swift b/Sources/Extensions/DataLoading/CursorType/CursorType+RxDataSourceDefaultImplementation.swift index ca7d636a..c3d4bec9 100644 --- a/Sources/Extensions/DataLoading/CursorType/CursorType+RxDataSourceDefaultImplementation.swift +++ b/Sources/Extensions/DataLoading/CursorType/CursorType+RxDataSourceDefaultImplementation.swift @@ -25,6 +25,6 @@ import RxSwift public extension RxDataSource where Self: CursorType { func resultSingle() -> Single<[Element]> { - return loadNextBatch() + loadNextBatch() } } diff --git a/Sources/Extensions/DataLoading/CursorType/CursorType+Slice.swift b/Sources/Extensions/DataLoading/CursorType/CursorType+Slice.swift index 5d0fa258..08c204c2 100644 --- a/Sources/Extensions/DataLoading/CursorType/CursorType+Slice.swift +++ b/Sources/Extensions/DataLoading/CursorType/CursorType+Slice.swift @@ -25,14 +25,14 @@ import Foundation public extension CursorType { subscript(range: CountableRange) -> [Self.Element] { - return range.map { self[$0] } + range.map { self[$0] } } subscript(range: CountableClosedRange) -> [Self.Element] { - return range.map { self[$0] } + range.map { self[$0] } } var loadedElements: [Self.Element] { - return self[0..(transform: ((ElementType) -> E)) -> DefaultTotalCountCursorListingResult { - return DefaultTotalCountCursorListingResult(results: results.map(transform), - totalCount: totalCount) + DefaultTotalCountCursorListingResult(results: results.map(transform), + totalCount: totalCount) } /// Method that creates DefaultTotalCountCursorListingResult @@ -37,7 +37,7 @@ public extension TotalCountCursorListingResult { /// /// - Returns: new DefaultTotalCountCursorListingResult instance func asDefaultListingResult() -> DefaultTotalCountCursorListingResult { - return DefaultTotalCountCursorListingResult(results: results, - totalCount: totalCount) + DefaultTotalCountCursorListingResult(results: results, + totalCount: totalCount) } } diff --git a/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingController+DefaultImplementation.swift b/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingController+DefaultImplementation.swift index dedbbaa7..7ef5daa2 100644 --- a/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingController+DefaultImplementation.swift +++ b/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingController+DefaultImplementation.swift @@ -28,13 +28,13 @@ public extension GeneralDataLoadingController { // MARK: - DisposeBagHolder default implementation var disposeBag: DisposeBag { - return viewModel.disposeBag + viewModel.disposeBag } // MARK: - StatefulViewController default implementation func hasContent() -> Bool { - return viewModel.hasContent + viewModel.hasContent } // MARK: - GeneralDataLoadingController default implementation diff --git a/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingHandler+Extensions.swift b/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingHandler+Extensions.swift index a031fe86..daee929e 100644 --- a/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingHandler+Extensions.swift +++ b/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingHandler+Extensions.swift @@ -27,7 +27,7 @@ import RxCocoa internal extension GeneralDataLoadingHandler where Self: AnyObject { var stateChangeBinder: Binder>> { - return Binder(self) { base, value in + Binder(self) { base, value in switch value { case .loading: base.onLoadingState() diff --git a/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingViewModel+Extensions.swift b/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingViewModel+Extensions.swift index e3ea9ea2..092b8187 100644 --- a/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingViewModel+Extensions.swift +++ b/Sources/Extensions/DataLoading/GeneralDataLoading/GeneralDataLoadingViewModel+Extensions.swift @@ -34,7 +34,7 @@ public extension GeneralDataLoadingViewModel { /// Emit elements of ResultType from state observable. var resultObservable: Observable { - return loadingStateObservable.flatMap { state -> Observable in + loadingStateObservable.flatMap { state -> Observable in switch state { case .result(let newResult, _): return .just(newResult) @@ -47,7 +47,7 @@ public extension GeneralDataLoadingViewModel { /// Emit elements of ResultType from state driver. var resultDriver: Driver { - return loadingStateDriver.flatMap { state -> Driver in + loadingStateDriver.flatMap { state -> Driver in switch state { case .result(let newResult, _): return .just(newResult) diff --git a/Sources/Extensions/DataLoading/PaginationDataLoading/PaginationWrapperUIDelegate+DefaultImplementation.swift b/Sources/Extensions/DataLoading/PaginationDataLoading/PaginationWrapperUIDelegate+DefaultImplementation.swift index 74819c6b..52d9a002 100644 --- a/Sources/Extensions/DataLoading/PaginationDataLoading/PaginationWrapperUIDelegate+DefaultImplementation.swift +++ b/Sources/Extensions/DataLoading/PaginationDataLoading/PaginationWrapperUIDelegate+DefaultImplementation.swift @@ -25,15 +25,15 @@ import UIKit public extension PaginationWrapperUIDelegate { func emptyPlaceholder() -> UIView? { - return TextPlaceholderView(title: .empty) + TextPlaceholderView(title: .empty) } func customInitialLoadingErrorHandling(for error: Error) -> Bool { - return false + false } func errorPlaceholder(for error: Error) -> UIView? { - return TextPlaceholderView(title: .error) + TextPlaceholderView(title: .error) } func initialLoadingIndicator() -> AnyLoadingIndicator? { @@ -58,7 +58,7 @@ public extension PaginationWrapperUIDelegate { } func footerRetryViewHeight() -> CGFloat { - return 44 + 44 } func footerRetryViewWillAppear() { diff --git a/Sources/Extensions/DataLoading/PaginationDataLoading/UITableView+PaginationWrappable.swift b/Sources/Extensions/DataLoading/PaginationDataLoading/UITableView+PaginationWrappable.swift index 40bda85e..3c372a7d 100644 --- a/Sources/Extensions/DataLoading/PaginationDataLoading/UITableView+PaginationWrappable.swift +++ b/Sources/Extensions/DataLoading/PaginationDataLoading/UITableView+PaginationWrappable.swift @@ -26,7 +26,7 @@ extension UITableView: PaginationWrappable { public var footerView: UIView? { get { - return tableFooterView + tableFooterView } set { tableFooterView = newValue diff --git a/Sources/Extensions/DataLoading/Rx+RxDataSourceProtocol.swift b/Sources/Extensions/DataLoading/Rx+RxDataSourceProtocol.swift index a9ec5f4a..aba56b02 100644 --- a/Sources/Extensions/DataLoading/Rx+RxDataSourceProtocol.swift +++ b/Sources/Extensions/DataLoading/Rx+RxDataSourceProtocol.swift @@ -28,7 +28,7 @@ extension Observable: RxDataSource { public typealias ResultType = Element public func resultSingle() -> Single { - return asSingle() + asSingle() } } @@ -41,6 +41,6 @@ extension Single: RxDataSource { public typealias ResultType = Element public func resultSingle() -> Single { - return asObservable().asSingle() + asObservable().asSingle() } } diff --git a/Sources/Extensions/DateFormattingService/DateFormattingService+DefaultImplementation.swift b/Sources/Extensions/DateFormattingService/DateFormattingService+DefaultImplementation.swift index ce613e27..fde7f9b1 100644 --- a/Sources/Extensions/DateFormattingService/DateFormattingService+DefaultImplementation.swift +++ b/Sources/Extensions/DateFormattingService/DateFormattingService+DefaultImplementation.swift @@ -28,7 +28,7 @@ public extension DateFormattingService { format: DateFormatType, defaultDate: DateInRegion = Date().inDefaultRegion()) -> DateInRegion { - return date(from: string, format: format, parsedIn: nil) ?? defaultDate + date(from: string, format: format, parsedIn: nil) ?? defaultDate } func date(from string: String, @@ -53,7 +53,7 @@ public extension DateFormattingService { } func string(from date: DateRepresentable, format: DateFormatType) -> String { - return format.dateToStringFormat.toString(date) + format.dateToStringFormat.toString(date) } func string(from date: DateRepresentable, format: DateFormatType, formattedIn: Region?) -> String { @@ -79,7 +79,7 @@ public extension DateFormattingService where Self: Singleton { format: DateFormatType, defaultDate: DateInRegion = Date().inDefaultRegion()) -> DateInRegion { - return shared.date(from: string, format: format, defaultDate: defaultDate) + shared.date(from: string, format: format, defaultDate: defaultDate) } /// Method parses date from string in given format with current region. @@ -90,7 +90,7 @@ public extension DateFormattingService where Self: Singleton { /// - parsedIn: A region that should be used for date parsing. In case of nil defaultRegion will be used. /// - Returns: Date parsed from given string or default date if parsing did fail. static func date(from string: String, format: DateFormatType, parsedIn: Region?) -> DateInRegion? { - return shared.date(from: string, format: format, parsedIn: parsedIn) + shared.date(from: string, format: format, parsedIn: parsedIn) } /// Method parses date from string in one of the given formats with current region. @@ -101,7 +101,7 @@ public extension DateFormattingService where Self: Singleton { /// - parsedIn: A region that should be used for date parsing. In case of nil defaultRegion will be used. /// - Returns: Date parsed from given string or default date if parsing did fail. static func date(from string: String, formats: [DateFormatType], parsedIn: Region?) -> DateInRegion? { - return shared.date(from: string, formats: formats, parsedIn: parsedIn) + shared.date(from: string, formats: formats, parsedIn: parsedIn) } /// Method format date in given format. @@ -111,7 +111,7 @@ public extension DateFormattingService where Self: Singleton { /// - format: Format that should be used for date formatting. /// - Returns: String that contains formatted date or nil if formatting did fail. static func string(from date: DateRepresentable, format: DateFormatType) -> String { - return shared.string(from: date, format: format) + shared.string(from: date, format: format) } /// Method format date in given format for specific region. @@ -122,6 +122,6 @@ public extension DateFormattingService where Self: Singleton { /// - formattedIn: A region that should be used for date formatting. In case of nil defaultRegion will be used. /// - Returns: String that contains formatted date or nil if formatting did fail. static func string(from date: DateRepresentable, format: DateFormatType, formattedIn: Region?) -> String { - return shared.string(from: date, format: format, formattedIn: formattedIn) + shared.string(from: date, format: format, formattedIn: formattedIn) } } diff --git a/Sources/Extensions/Decimal/Decimal+Values.swift b/Sources/Extensions/Decimal/Decimal+Values.swift index ec3c07e6..07da7a97 100644 --- a/Sources/Extensions/Decimal/Decimal+Values.swift +++ b/Sources/Extensions/Decimal/Decimal+Values.swift @@ -26,11 +26,11 @@ public extension Decimal { /// Conver Decimal to Double value var doubleValue: Double { - return NSDecimalNumber(decimal: self).doubleValue + NSDecimalNumber(decimal: self).doubleValue } /// Conver Decimal to Int value var intValue: Int { - return NSDecimalNumber(decimal: self).intValue + NSDecimalNumber(decimal: self).intValue } } diff --git a/Sources/Extensions/Drawing/CGContext/CGContext+Initializers.swift b/Sources/Extensions/Drawing/CGContext/CGContext+Initializers.swift index db32d618..0db3c30f 100644 --- a/Sources/Extensions/Drawing/CGContext/CGContext+Initializers.swift +++ b/Sources/Extensions/Drawing/CGContext/CGContext+Initializers.swift @@ -41,11 +41,11 @@ public extension CGContext { static func create(forCGImage cgImage: CGImage, fallbackColorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB()) -> CGContext? { - return create(width: cgImage.width, - height: cgImage.height, - bitmapInfo: cgImage.bitmapInfo, - colorSpace: cgImage.colorSpace ?? fallbackColorSpace, - bitsPerComponent: cgImage.bitsPerComponent) + create(width: cgImage.width, + height: cgImage.height, + bitmapInfo: cgImage.bitmapInfo, + colorSpace: cgImage.colorSpace ?? fallbackColorSpace, + bitsPerComponent: cgImage.bitsPerComponent) } /// Creates a bitmap graphics context. @@ -65,12 +65,12 @@ public extension CGContext { colorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB(), bitsPerComponent: Int = 8) -> CGContext? { - return CGContext(data: nil, - width: width, - height: height, - bitsPerComponent: bitsPerComponent, - bytesPerRow: 0, - space: colorSpace, - bitmapInfo: bitmapInfo.rawValue) + CGContext(data: nil, + width: width, + height: height, + bitsPerComponent: bitsPerComponent, + bytesPerRow: 0, + space: colorSpace, + bitmapInfo: bitmapInfo.rawValue) } } diff --git a/Sources/Extensions/Drawing/CGSize/CGSize+CGContextSize.swift b/Sources/Extensions/Drawing/CGSize/CGSize+CGContextSize.swift index 9243079c..65dce12c 100644 --- a/Sources/Extensions/Drawing/CGSize/CGSize+CGContextSize.swift +++ b/Sources/Extensions/Drawing/CGSize/CGSize+CGContextSize.swift @@ -25,6 +25,6 @@ import CoreGraphics.CGGeometry public extension CGSize { var ceiledContextSize: CGContextSize { - return (width: Int(ceil(width)), height: Int(ceil(height))) + (width: Int(ceil(width)), height: Int(ceil(height))) } } diff --git a/Sources/Extensions/Drawing/UIImage/UIImage+Extensions.swift b/Sources/Extensions/Drawing/UIImage/UIImage+Extensions.swift index 8992b89b..c7fabcd3 100644 --- a/Sources/Extensions/Drawing/UIImage/UIImage+Extensions.swift +++ b/Sources/Extensions/Drawing/UIImage/UIImage+Extensions.swift @@ -55,7 +55,7 @@ public extension UIImage { /// - Parameter color: Color to fill template image. /// - Returns: A new UIImage rendered with given color or original image if something goes wrong. func renderTemplate(withColor color: UIColor) -> UIImage { - return withCGImage { image in + withCGImage { image in let operation = TemplateDrawingOperation(image: image, imageSize: size, color: color.cgColor) @@ -77,7 +77,7 @@ public extension UIImage { color: UIColor, extendSize: Bool = false) -> UIImage { - return withCGImage { image in + withCGImage { image in let roundOperation = RoundDrawingOperation(image: image, imageSize: size, radius: cornerRadius) @@ -101,7 +101,7 @@ public extension UIImage { /// /// - Returns: A new circled image or original image if something goes wrong. func roundCornersToCircle() -> UIImage { - return withCGImage { image in + withCGImage { image in let radius = CGFloat(min(size.width, size.height) / 2) let operation = RoundDrawingOperation(image: image, @@ -123,7 +123,7 @@ public extension UIImage { borderColor: UIColor, extendSize: Bool = false) -> UIImage { - return withCGImage { image in + withCGImage { image in let radius = CGFloat(min(size.width, size.height) / 2) let roundOperation = RoundDrawingOperation(image: image, @@ -157,7 +157,7 @@ public extension UIImage { contentMode: ResizeMode = .scaleToFill, cropToImageBounds: Bool = false) -> UIImage { - return withCGImage { image in + withCGImage { image in let operation = ResizeDrawingOperation(image: image, imageSize: size, preferredNewSize: newSize, @@ -172,7 +172,7 @@ public extension UIImage { /// /// - Returns: A copy of the given image, adding an alpha channel if it doesn't already have one. func applyAlpha() -> UIImage { - return withCGImage { image in + withCGImage { image in guard !image.hasAlpha else { return self } @@ -190,7 +190,7 @@ public extension UIImage { /// - Parameter padding: The padding amount. /// - Returns: A new padded image or original image if something goes wrong. func applyPadding(_ padding: CGFloat) -> UIImage { - return withCGImage { image in + withCGImage { image in let operation = PaddingDrawingOperation(image: image, imageSize: size, padding: padding) return operation.imageFromNewRenderer(scale: scale).redraw() @@ -204,7 +204,7 @@ public extension UIImage { /// - clockwise: Should rotate image clockwise. /// - Returns: A new rotated image or original image if something goes wrong. func rotate(degrees: CGFloat, clockwise: Bool = true) -> UIImage { - return withCGImage { image in + withCGImage { image in let radians = degrees.degreesToRadians() let operation = RotateDrawingOperation(image: image, @@ -218,7 +218,7 @@ public extension UIImage { /// Workaround to fix flipped image rendering (by Y) private func redraw() -> UIImage { - return withCGImage { image in + withCGImage { image in let operation = ImageDrawingOperation(image: image, newSize: size) return operation.imageFromNewRenderer(scale: scale) diff --git a/Sources/Extensions/Error/Error+NetworkExtensions.swift b/Sources/Extensions/Error/Error+NetworkExtensions.swift index 36cd9b31..a458681c 100644 --- a/Sources/Extensions/Error/Error+NetworkExtensions.swift +++ b/Sources/Extensions/Error/Error+NetworkExtensions.swift @@ -25,7 +25,7 @@ import RxSwift public extension Error { var requestError: RequestError? { - return self as? RequestError + self as? RequestError } /// Method that tries to serialize response from a mapping request error to a model @@ -52,7 +52,7 @@ public extension ObservableType { /// - Returns: Observable on caller func handleMappingError(with decoder: JSONDecoder = JSONDecoder(), handler: @escaping ParameterClosure) -> Observable { - return self.do(onError: { error in + self.do(onError: { error in guard let errorModel = try error.handleMappingError(with: decoder) as T? else { return } @@ -72,7 +72,7 @@ public extension PrimitiveSequence where Trait == SingleTrait { /// - Returns: Single on caller func handleMappingError(with decoder: JSONDecoder = JSONDecoder(), handler: @escaping ParameterClosure) -> PrimitiveSequence { - return self.do(onError: { error in + self.do(onError: { error in guard let errorModel = try error.handleMappingError(with: decoder) as T? else { return } @@ -92,7 +92,7 @@ public extension PrimitiveSequence where Trait == CompletableTrait, Element == N /// - Returns: Completable func handleMappingError(with decoder: JSONDecoder = JSONDecoder(), handler: @escaping ParameterClosure) -> Completable { - return self.do(onError: { error in + self.do(onError: { error in guard let errorModel = try error.handleMappingError(with: decoder) as T? else { return } diff --git a/Sources/Extensions/FloatingPoint/FloatingPoint+DegreesRadiansConvertion.swift b/Sources/Extensions/FloatingPoint/FloatingPoint+DegreesRadiansConvertion.swift index fc861f28..42d7f585 100644 --- a/Sources/Extensions/FloatingPoint/FloatingPoint+DegreesRadiansConvertion.swift +++ b/Sources/Extensions/FloatingPoint/FloatingPoint+DegreesRadiansConvertion.swift @@ -26,13 +26,13 @@ public extension FloatingPoint { /// /// - Returns: radians func degreesToRadians() -> Self { - return self * .pi / 180 + self * .pi / 180 } /// Converts radians to degrees /// /// - Returns: degrees func radiansToDegrees() -> Self { - return self * 180 / .pi + self * 180 / .pi } } diff --git a/Sources/Extensions/Foundation/UserDefaults/UserDefaults+Codable.swift b/Sources/Extensions/Foundation/UserDefaults/UserDefaults+Codable.swift index 459d5519..8aa105b8 100644 --- a/Sources/Extensions/Foundation/UserDefaults/UserDefaults+Codable.swift +++ b/Sources/Extensions/Foundation/UserDefaults/UserDefaults+Codable.swift @@ -38,7 +38,7 @@ public extension UserDefaults { /// - Returns: The object with specified type associated with the specified key, or passed default value /// if there is no such value for specified key or if error occurred during mapping. func object(forKey key: String, defaultValue: T, decoder: JSONDecoder = JSONDecoder()) -> T { - return (try? object(forKey: key, decoder: decoder)) ?? defaultValue + (try? object(forKey: key, decoder: decoder)) ?? defaultValue } /// Set or remove the value of the specified default key in the standard application domain. @@ -58,7 +58,7 @@ public extension UserDefaults { subscript(key: String) -> T? { get { - return try? object(forKey: key) + try? object(forKey: key) } set { try? set(object: newValue, forKey: key) @@ -75,7 +75,7 @@ public extension Reactive where Base: UserDefaults { /// - decoder: JSON decoder to decode stored data. /// - Returns: Single of specified model type. func object(forKey key: String, decoder: JSONDecoder = JSONDecoder()) -> Single { - return .deferredJust { try self.base.object(forKey: key, decoder: decoder) } + .deferredJust { try self.base.object(forKey: key, decoder: decoder) } } /// Reactive version of object(forKey:defaultValue:decoder:) -> T. @@ -87,7 +87,7 @@ public extension Reactive where Base: UserDefaults { /// - decoder: JSON decoder to decode stored data. /// - Returns: Single of specified model type. func object(forKey key: String, defaultValue: T, decoder: JSONDecoder = JSONDecoder()) -> Single { - return .deferredJust { self.base.object(forKey: key, defaultValue: defaultValue, decoder: decoder) } + .deferredJust { self.base.object(forKey: key, defaultValue: defaultValue, decoder: decoder) } } /// Reactive version of set(object:forKey:encoder:). @@ -98,7 +98,7 @@ public extension Reactive where Base: UserDefaults { /// - encoder: JSON encoder to encode to encode passed object. /// - Returns: Completable. func set(object: T?, forKey key: String, encoder: JSONEncoder = JSONEncoder()) -> Completable { - return .deferredJust { + .deferredJust { try self.base.set(object: object, forKey: key, encoder: encoder) } } diff --git a/Sources/Extensions/NSAttributedString/NSAttributedString+Extensions.swift b/Sources/Extensions/NSAttributedString/NSAttributedString+Extensions.swift index 01be64df..c28cb2eb 100644 --- a/Sources/Extensions/NSAttributedString/NSAttributedString+Extensions.swift +++ b/Sources/Extensions/NSAttributedString/NSAttributedString+Extensions.swift @@ -33,7 +33,7 @@ public extension NSAttributedString { /// Mutable copy of attributed string. var mutable: NSMutableAttributedString { - return NSMutableAttributedString(attributedString: self) + NSMutableAttributedString(attributedString: self) } } @@ -51,6 +51,6 @@ public extension NSMutableAttributedString { /// Immutable copy of attributed string. var immutable: NSAttributedString { - return NSAttributedString(attributedString: self) + NSAttributedString(attributedString: self) } } diff --git a/Sources/Extensions/NumberFormattingService/BuildInNumberTypes+NSNumberConvertible.swift b/Sources/Extensions/NumberFormattingService/BuildInNumberTypes+NSNumberConvertible.swift index 014473c3..cb0e1b09 100644 --- a/Sources/Extensions/NumberFormattingService/BuildInNumberTypes+NSNumberConvertible.swift +++ b/Sources/Extensions/NumberFormattingService/BuildInNumberTypes+NSNumberConvertible.swift @@ -25,41 +25,41 @@ import Foundation extension NSNumber: NSNumberConvertible { public func asNSNumber() -> NSNumber { - return self + self } } extension Decimal: NSNumberConvertible { public func asNSNumber() -> NSNumber { - return NSDecimalNumber(decimal: self) + NSDecimalNumber(decimal: self) } } extension Int: NSNumberConvertible { public func asNSNumber() -> NSNumber { - return NSNumber(value: self) + NSNumber(value: self) } } extension Int64: NSNumberConvertible { public func asNSNumber() -> NSNumber { - return NSNumber(value: self) + NSNumber(value: self) } } extension Double: NSNumberConvertible { public func asNSNumber() -> NSNumber { - return NSNumber(value: self) + NSNumber(value: self) } } extension Float: NSNumberConvertible { public func asNSNumber() -> NSNumber { - return NSNumber(value: self) + NSNumber(value: self) } } diff --git a/Sources/Extensions/NumberFormattingService/NumberFormattingService+DefaultImplementation.swift b/Sources/Extensions/NumberFormattingService/NumberFormattingService+DefaultImplementation.swift index e8302f51..7c72018e 100644 --- a/Sources/Extensions/NumberFormattingService/NumberFormattingService+DefaultImplementation.swift +++ b/Sources/Extensions/NumberFormattingService/NumberFormattingService+DefaultImplementation.swift @@ -26,7 +26,7 @@ public extension NumberFormattingService { /// Computed static property. Use only once for `formatters` field implementation! static var computedFormatters: [NumberFormatType: NumberFormatter] { - return Dictionary(uniqueKeysWithValues: NumberFormatType.allCases.map { ($0, $0.numberFormatter) }) + Dictionary(uniqueKeysWithValues: NumberFormatType.allCases.map { ($0, $0.numberFormatter) }) } func numberFormatter(for format: NumberFormatType) -> NumberFormatter { @@ -38,21 +38,21 @@ public extension NumberFormattingService { } func string(from number: NSNumberConvertible, format: NumberFormatType, defaultString: String = "") -> String { - return numberFormatter(for: format).string(from: number.asNSNumber()) ?? defaultString + numberFormatter(for: format).string(from: number.asNSNumber()) ?? defaultString } func number(from string: String, format: NumberFormatType) -> NSNumber? { - return numberFormatter(for: format).number(from: string) + numberFormatter(for: format).number(from: string) } } public extension NumberFormattingService where Self: Singleton { static func string(from number: NSNumberConvertible, format: NumberFormatType, defaultString: String = "") -> String { - return shared.string(from: number, format: format, defaultString: defaultString) + shared.string(from: number, format: format, defaultString: defaultString) } static func number(from string: String, format: NumberFormatType) -> NSNumber? { - return shared.number(from: string, format: format) + shared.number(from: string, format: format) } } diff --git a/Sources/Extensions/Rx/ObservableType/Observable+DeferredJust.swift b/Sources/Extensions/Rx/ObservableType/Observable+DeferredJust.swift index 9abaa737..84f8016d 100644 --- a/Sources/Extensions/Rx/ObservableType/Observable+DeferredJust.swift +++ b/Sources/Extensions/Rx/ObservableType/Observable+DeferredJust.swift @@ -30,7 +30,7 @@ public extension ObservableType { /// that subscribes to the resulting sequence. /// - Returns: An observable sequence whose observers trigger an invocation of the given element factory function. static func deferredJust(_ elementFactory: @escaping () throws -> Element) -> Observable { - return .create { observer in + .create { observer in do { observer.onNext(try elementFactory()) observer.onCompleted() diff --git a/Sources/Extensions/Rx/ObservableType/ObservableType+Extensions.swift b/Sources/Extensions/Rx/ObservableType/ObservableType+Extensions.swift index 4745cd1b..5da1c6f2 100644 --- a/Sources/Extensions/Rx/ObservableType/ObservableType+Extensions.swift +++ b/Sources/Extensions/Rx/ObservableType/ObservableType+Extensions.swift @@ -29,20 +29,20 @@ public extension ObservableType { /// - Parameter value: A new element. /// - Returns: An observable sequence whose elements are equals to passed value. func replace(with value: T) -> Observable { - return map { _ in value } // swiftlint:disable:this unused_map_parameter + map { _ in value } // swiftlint:disable:this unused_map_parameter } /// Replaces all emitted elements with Void. /// /// - Returns: An observable sequence whose elements are equals to Void. func asVoid() -> Observable { - return replace(with: Void()) + replace(with: Void()) } /// Cast all emitted elements to optional type. /// /// - Returns: An observable sequence whose elements are equals to optional type of element. func asOptional() -> Observable { - return map { $0 } + map { $0 } } } diff --git a/Sources/Extensions/Rx/PrimitiveSequence/Completable/Completable+DeferredJust.swift b/Sources/Extensions/Rx/PrimitiveSequence/Completable/Completable+DeferredJust.swift index 9151e254..eddb7431 100644 --- a/Sources/Extensions/Rx/PrimitiveSequence/Completable/Completable+DeferredJust.swift +++ b/Sources/Extensions/Rx/PrimitiveSequence/Completable/Completable+DeferredJust.swift @@ -30,7 +30,7 @@ public extension PrimitiveSequence where Trait == CompletableTrait { /// that subscribes to the resulting sequence. /// - Returns: A single whose observers trigger an invocation of the given element factory function. static func deferredJust(_ workUnit: @escaping ThrowableVoidBlock) -> Completable { - return .create { observer in + .create { observer in do { try workUnit() observer(.completed) diff --git a/Sources/Extensions/Rx/PrimitiveSequence/Single/Single+DeferredJust.swift b/Sources/Extensions/Rx/PrimitiveSequence/Single/Single+DeferredJust.swift index bfb66c15..f1e5dc6a 100644 --- a/Sources/Extensions/Rx/PrimitiveSequence/Single/Single+DeferredJust.swift +++ b/Sources/Extensions/Rx/PrimitiveSequence/Single/Single+DeferredJust.swift @@ -30,7 +30,7 @@ public extension Single { /// that subscribes to the resulting sequence. /// - Returns: A single whose observers trigger an invocation of the given element factory function. static func deferredJust(_ elementFactory: @escaping () throws -> Element) -> Single { - return .create { observer in + .create { observer in do { observer(.success(try elementFactory())) } catch { diff --git a/Sources/Extensions/Rx/PrimitiveSequence/Single/Single+Extensions.swift b/Sources/Extensions/Rx/PrimitiveSequence/Single/Single+Extensions.swift index 94f68b1e..0de0bb5f 100644 --- a/Sources/Extensions/Rx/PrimitiveSequence/Single/Single+Extensions.swift +++ b/Sources/Extensions/Rx/PrimitiveSequence/Single/Single+Extensions.swift @@ -29,20 +29,20 @@ public extension PrimitiveSequence where Trait == SingleTrait { /// - Parameter value: A new element. /// - Returns: An primitive sequence whose element is equal to passed value. func replace(with value: T) -> PrimitiveSequence { - return map { _ in value } // swiftlint:disable:this unused_map_parameter + map { _ in value } // swiftlint:disable:this unused_map_parameter } /// Replaces emitted element with Void. /// /// - Returns: An primitive sequence whose element is equal to Void. func asVoid() -> PrimitiveSequence { - return replace(with: Void()) + replace(with: Void()) } /// Cast emitted element to optional type. /// /// - Returns: An primitive sequence whose element is equals to optional type of element. func asOptional() -> PrimitiveSequence { - return map { $0 } + map { $0 } } } diff --git a/Sources/Extensions/Rx/SharedSequence/SharedSequence+Extensions.swift b/Sources/Extensions/Rx/SharedSequence/SharedSequence+Extensions.swift index 75574d5e..12a15088 100644 --- a/Sources/Extensions/Rx/SharedSequence/SharedSequence+Extensions.swift +++ b/Sources/Extensions/Rx/SharedSequence/SharedSequence+Extensions.swift @@ -29,20 +29,20 @@ public extension SharedSequence { /// - Parameter value: A new element. /// - Returns: An observable sequence whose elements are equals to passed value. func replace(with value: T) -> SharedSequence { - return map { _ in value } // swiftlint:disable:this unused_map_parameter + map { _ in value } // swiftlint:disable:this unused_map_parameter } /// Replaces all emitted elements with Void. /// /// - Returns: An observable sequence whose elements are equals to Void. func asVoid() -> SharedSequence { - return replace(with: Void()) + replace(with: Void()) } /// Cast all emitted elements to optional type. /// /// - Returns: An observable sequence whose elements are equals to optional type of element. func asOptional() -> SharedSequence { - return map { $0 } + map { $0 } } } diff --git a/Sources/Extensions/String/String+Extensions.swift b/Sources/Extensions/String/String+Extensions.swift index 307e2233..9d350b6a 100644 --- a/Sources/Extensions/String/String+Extensions.swift +++ b/Sources/Extensions/String/String+Extensions.swift @@ -30,6 +30,6 @@ public extension String { - returns: nil if string empty, self otherwise */ var nilIfEmpty: String? { - return isEmpty ? nil : self + isEmpty ? nil : self } } diff --git a/Sources/Extensions/String/String+Localization.swift b/Sources/Extensions/String/String+Localization.swift index 897275f7..675080ec 100644 --- a/Sources/Extensions/String/String+Localization.swift +++ b/Sources/Extensions/String/String+Localization.swift @@ -30,6 +30,6 @@ public extension String { - returns: localized string */ func localized() -> String { - return NSLocalizedString(self, comment: "") + NSLocalizedString(self, comment: "") } } diff --git a/Sources/Extensions/TableKit/TableDirector/TableDirector+Extensions.swift b/Sources/Extensions/TableKit/TableDirector/TableDirector+Extensions.swift index 150447ac..0f74619e 100644 --- a/Sources/Extensions/TableKit/TableDirector/TableDirector+Extensions.swift +++ b/Sources/Extensions/TableKit/TableDirector/TableDirector+Extensions.swift @@ -96,7 +96,7 @@ public extension TableDirector { */ @discardableResult func replace(withSection section: TableSection) -> Self { - return replace(withSections: [section]) + replace(withSections: [section]) } /** @@ -108,7 +108,7 @@ public extension TableDirector { */ @discardableResult func replace(withRows rows: [Row]) -> Self { - return replace(withSection: TableSection(rows: rows)) + replace(withSection: TableSection(rows: rows)) } /// Clear table view and reload it within empty section diff --git a/Sources/Extensions/TableKit/TableDirector/TableRow+SeparatorsExtensions.swift b/Sources/Extensions/TableKit/TableDirector/TableRow+SeparatorsExtensions.swift index 0e1c510d..0a0d24b8 100644 --- a/Sources/Extensions/TableKit/TableDirector/TableRow+SeparatorsExtensions.swift +++ b/Sources/Extensions/TableKit/TableDirector/TableRow+SeparatorsExtensions.swift @@ -47,6 +47,6 @@ public extension TableRow where CellType: SeparatorCell { /// TableRow typed as SeparatorRowBox var separatorRowBox: SeparatorRowBox { - return SeparatorRowBox(row: self) + SeparatorRowBox(row: self) } } diff --git a/Sources/Extensions/TableKit/TableKitViewModel/TableKitViewModel+Extenstions.swift b/Sources/Extensions/TableKit/TableKitViewModel/TableKitViewModel+Extenstions.swift index aeeb0b3a..1df7e323 100644 --- a/Sources/Extensions/TableKit/TableKitViewModel/TableKitViewModel+Extenstions.swift +++ b/Sources/Extensions/TableKit/TableKitViewModel/TableKitViewModel+Extenstions.swift @@ -29,6 +29,6 @@ public extension TableKitViewModel { /// Returns TableRow initialized with current view model. var tableRow: RowType { - return RowType(item: self) + RowType(item: self) } } diff --git a/Sources/Extensions/UIKit/CollectionViewHolder/CollectionViewHolder+ScrollViewHolder.swift b/Sources/Extensions/UIKit/CollectionViewHolder/CollectionViewHolder+ScrollViewHolder.swift index 2f48d0ef..4f544675 100644 --- a/Sources/Extensions/UIKit/CollectionViewHolder/CollectionViewHolder+ScrollViewHolder.swift +++ b/Sources/Extensions/UIKit/CollectionViewHolder/CollectionViewHolder+ScrollViewHolder.swift @@ -25,6 +25,6 @@ import UIKit.UIScrollView public extension ScrollViewHolder where Self: CollectionViewHolder { var scrollView: UIScrollView { - return collectionView + collectionView } } diff --git a/Sources/Extensions/UIKit/TableViewHolder/TableViewHolder+ScrollViewHolder.swift b/Sources/Extensions/UIKit/TableViewHolder/TableViewHolder+ScrollViewHolder.swift index c6526ef9..ebe717ca 100644 --- a/Sources/Extensions/UIKit/TableViewHolder/TableViewHolder+ScrollViewHolder.swift +++ b/Sources/Extensions/UIKit/TableViewHolder/TableViewHolder+ScrollViewHolder.swift @@ -25,6 +25,6 @@ import UIKit.UIScrollView public extension ScrollViewHolder where Self: TableViewHolder { var scrollView: UIScrollView { - return tableView + tableView } } diff --git a/Sources/Extensions/UIKit/UIButton/UIButton+ViewTextConfigurable.swift b/Sources/Extensions/UIKit/UIButton/UIButton+ViewTextConfigurable.swift index fdffbac4..5db6229f 100644 --- a/Sources/Extensions/UIKit/UIButton/UIButton+ViewTextConfigurable.swift +++ b/Sources/Extensions/UIKit/UIButton/UIButton+ViewTextConfigurable.swift @@ -26,7 +26,7 @@ extension UIButton: ViewTextConfigurable { public var textFont: UIFont? { get { - return titleLabel?.font + titleLabel?.font } set { titleLabel?.font = newValue @@ -35,7 +35,7 @@ extension UIButton: ViewTextConfigurable { public var titleColor: UIColor? { get { - return currentTitleColor + currentTitleColor } set { setTitleColor(newValue, for: []) @@ -44,7 +44,7 @@ extension UIButton: ViewTextConfigurable { public var textAlignment: NSTextAlignment { get { - return contentHorizontalAlignment.textAlignment + contentHorizontalAlignment.textAlignment } set { contentHorizontalAlignment = .init(textAlignment: newValue) @@ -53,7 +53,7 @@ extension UIButton: ViewTextConfigurable { public var text: String? { get { - return currentTitle + currentTitle } set { setTitle(newValue, for: []) @@ -62,7 +62,7 @@ extension UIButton: ViewTextConfigurable { public var attributedText: NSAttributedString? { get { - return currentAttributedTitle + currentAttributedTitle } set { setAttributedTitle(newValue, for: []) diff --git a/Sources/Extensions/UIKit/UIImageView/UIImageView+ExpandCollapseDisclosure.swift b/Sources/Extensions/UIKit/UIImageView/UIImageView+ExpandCollapseDisclosure.swift index af58b6eb..ae6e12e4 100644 --- a/Sources/Extensions/UIKit/UIImageView/UIImageView+ExpandCollapseDisclosure.swift +++ b/Sources/Extensions/UIKit/UIImageView/UIImageView+ExpandCollapseDisclosure.swift @@ -30,7 +30,7 @@ public extension UIImageView { /// Rotates image view by 180 degrees via transform property with animation. var expandRotationBinder: Binder { - return Binder(self) { view, isExpanded in + Binder(self) { view, isExpanded in let angle = isExpanded ? CGFloat.pi / 2 : -CGFloat.pi / 2 diff --git a/Sources/Extensions/UIKit/UILabel/UILabel+ViewTextConfigurable.swift b/Sources/Extensions/UIKit/UILabel/UILabel+ViewTextConfigurable.swift index b213a850..5de3aebf 100644 --- a/Sources/Extensions/UIKit/UILabel/UILabel+ViewTextConfigurable.swift +++ b/Sources/Extensions/UIKit/UILabel/UILabel+ViewTextConfigurable.swift @@ -26,7 +26,7 @@ extension UILabel: ViewTextConfigurable { public var textFont: UIFont? { get { - return font + font } set { font = newValue @@ -35,7 +35,7 @@ extension UILabel: ViewTextConfigurable { public var titleColor: UIColor? { get { - return textColor + textColor } set { textColor = newValue diff --git a/Sources/Extensions/UIKit/UIScrollView/UIScrollView+RxBindings.swift b/Sources/Extensions/UIKit/UIScrollView/UIScrollView+RxBindings.swift index 6e7c3793..9ca8568c 100644 --- a/Sources/Extensions/UIKit/UIScrollView/UIScrollView+RxBindings.swift +++ b/Sources/Extensions/UIKit/UIScrollView/UIScrollView+RxBindings.swift @@ -28,7 +28,7 @@ public extension Reactive where Base: UIScrollView { /// Binder instance that updates contentInset bottom value. /// If it doesn't work, observe it on MainScheduler.asyncInstance. var bottomInsetBinder: Binder { - return Binder(base) { base, value in + Binder(base) { base, value in base.contentInset.bottom = value base.scrollIndicatorInsets.bottom = value } diff --git a/Sources/Extensions/UIKit/UIScrollView/UIScrollView+ScrollViewHolder.swift b/Sources/Extensions/UIKit/UIScrollView/UIScrollView+ScrollViewHolder.swift index 6a8af8ff..3ca47d1f 100644 --- a/Sources/Extensions/UIKit/UIScrollView/UIScrollView+ScrollViewHolder.swift +++ b/Sources/Extensions/UIKit/UIScrollView/UIScrollView+ScrollViewHolder.swift @@ -25,6 +25,6 @@ import UIKit.UIScrollView extension UIScrollView: ScrollViewHolder { public var scrollView: UIScrollView { - return self + self } } diff --git a/Sources/Extensions/UIKit/UITableView/UITableView+TableViewHolder.swift b/Sources/Extensions/UIKit/UITableView/UITableView+TableViewHolder.swift index 93742261..8a12d000 100644 --- a/Sources/Extensions/UIKit/UITableView/UITableView+TableViewHolder.swift +++ b/Sources/Extensions/UIKit/UITableView/UITableView+TableViewHolder.swift @@ -25,6 +25,6 @@ import UIKit.UITableView extension UITableView: TableViewHolder { public var tableView: UITableView { - return self + self } } diff --git a/Sources/Extensions/UIKit/UITextField/UITextField+ViewTextConfigurable.swift b/Sources/Extensions/UIKit/UITextField/UITextField+ViewTextConfigurable.swift index c981ed2e..24381e3c 100644 --- a/Sources/Extensions/UIKit/UITextField/UITextField+ViewTextConfigurable.swift +++ b/Sources/Extensions/UIKit/UITextField/UITextField+ViewTextConfigurable.swift @@ -26,7 +26,7 @@ extension UITextField: ViewTextConfigurable { public var textFont: UIFont? { get { - return font + font } set { font = newValue @@ -35,7 +35,7 @@ extension UITextField: ViewTextConfigurable { public var titleColor: UIColor? { get { - return textColor + textColor } set { textColor = newValue diff --git a/Sources/Extensions/UIKit/UIView/UIView+LoadFromNib.swift b/Sources/Extensions/UIKit/UIView/UIView+LoadFromNib.swift index a96063c7..1dd54e9f 100644 --- a/Sources/Extensions/UIKit/UIView/UIView+LoadFromNib.swift +++ b/Sources/Extensions/UIKit/UIView/UIView+LoadFromNib.swift @@ -31,7 +31,7 @@ public extension UIView { /// If you specify nil, this method looks for the nib file in the main bundle. /// - Returns: UIView or UIView subclass instance static func loadFromNib(bundle: Bundle? = nil) -> T where T: UIView { - return loadFromNib(named: T.xibName, bundle: bundle) + loadFromNib(named: T.xibName, bundle: bundle) } /// Method which loads UIView (or subclass) instance from nib using given nib name parameter diff --git a/Sources/Extensions/UIKit/UIView/UIView+LoadingIndicator.swift b/Sources/Extensions/UIKit/UIView/UIView+LoadingIndicator.swift index 43288f0a..98e2e37f 100644 --- a/Sources/Extensions/UIKit/UIView/UIView+LoadingIndicator.swift +++ b/Sources/Extensions/UIKit/UIView/UIView+LoadingIndicator.swift @@ -25,6 +25,6 @@ import UIKit public extension LoadingIndicator where Self: UIView { var view: Self { - return self + self } } diff --git a/Sources/Extensions/UIKit/UIView/UIView+XibNameProtocol.swift b/Sources/Extensions/UIKit/UIView/UIView+XibNameProtocol.swift index cf3888fd..14d58f6b 100644 --- a/Sources/Extensions/UIKit/UIView/UIView+XibNameProtocol.swift +++ b/Sources/Extensions/UIKit/UIView/UIView+XibNameProtocol.swift @@ -25,6 +25,6 @@ import UIKit extension UIView: XibNameProtocol { open class var xibName: String { - return typeName(of: self) + typeName(of: self) } } diff --git a/Sources/Extensions/UIKit/UIViewController/UIViewController+DefaultXibName.swift b/Sources/Extensions/UIKit/UIViewController/UIViewController+DefaultXibName.swift index 4af9a608..13c56e22 100644 --- a/Sources/Extensions/UIKit/UIViewController/UIViewController+DefaultXibName.swift +++ b/Sources/Extensions/UIKit/UIViewController/UIViewController+DefaultXibName.swift @@ -25,6 +25,6 @@ import UIKit extension UIViewController: XibNameProtocol { open class var xibName: String { - return typeName(of: self) + typeName(of: self) } } diff --git a/Sources/Extensions/Views/PlaceholderConfigurable/ContentLoadingViewModel+Extensions.swift b/Sources/Extensions/Views/PlaceholderConfigurable/ContentLoadingViewModel+Extensions.swift index 3bf2443f..65f78237 100644 --- a/Sources/Extensions/Views/PlaceholderConfigurable/ContentLoadingViewModel+Extensions.swift +++ b/Sources/Extensions/Views/PlaceholderConfigurable/ContentLoadingViewModel+Extensions.swift @@ -36,7 +36,7 @@ public extension ContentLoadingViewModel where PlaceholderType == Void { /// Creates ContentLoadingViewModel with placeholder. static var placeholder: ContentLoadingViewModel { - return .placeholder(()) + .placeholder(()) } } @@ -47,6 +47,6 @@ public extension ContentLoadingViewModel where PlaceholderType == [Void] { /// - Parameter numberOfItems: Number of placeholders to create. /// - Returns: ContentLoadingViewModel with placeholder. static func placeholders(numberOfItems: Int) -> ContentLoadingViewModel { - return .placeholder(Array(repeating: (), count: numberOfItems)) + .placeholder(Array(repeating: (), count: numberOfItems)) } } diff --git a/Sources/Extensions/Views/PlaceholderConfigurable/PlaceholderConfigurable+DefaultImplementation.swift b/Sources/Extensions/Views/PlaceholderConfigurable/PlaceholderConfigurable+DefaultImplementation.swift index 583e4cbb..9ef938b9 100644 --- a/Sources/Extensions/Views/PlaceholderConfigurable/PlaceholderConfigurable+DefaultImplementation.swift +++ b/Sources/Extensions/Views/PlaceholderConfigurable/PlaceholderConfigurable+DefaultImplementation.swift @@ -51,6 +51,6 @@ public extension PlaceholderConfigurable { /// - Parameter contentViewModel: Content of ContentLoadingViewModel. /// - Returns: ContentLoadingViewModel with content. static func content(with contentViewModel: ContentViewModelType) -> ContentLoadingViewModelType { - return .content(contentViewModel) + .content(contentViewModel) } } diff --git a/Sources/Extensions/Views/SeparatorCell/CellSeparatorType+Extensions.swift b/Sources/Extensions/Views/SeparatorCell/CellSeparatorType+Extensions.swift index 91eff3d5..8e07e322 100644 --- a/Sources/Extensions/Views/SeparatorCell/CellSeparatorType+Extensions.swift +++ b/Sources/Extensions/Views/SeparatorCell/CellSeparatorType+Extensions.swift @@ -26,12 +26,12 @@ public extension CellSeparatorType { /// Determine if bottom separator is hidden. var bottomIsHidden: Bool { - return bottomConfiguration == nil + bottomConfiguration == nil } /// Determine if top separator is hidden. var topIsHidden: Bool { - return topConfiguration == nil + topConfiguration == nil } /// Returns top configuration if type is top or full. diff --git a/Sources/Extensions/Views/SeparatorCell/SeparatorConfiguration+Extensions.swift b/Sources/Extensions/Views/SeparatorCell/SeparatorConfiguration+Extensions.swift index 65bb4874..4d8068f0 100644 --- a/Sources/Extensions/Views/SeparatorCell/SeparatorConfiguration+Extensions.swift +++ b/Sources/Extensions/Views/SeparatorCell/SeparatorConfiguration+Extensions.swift @@ -26,6 +26,6 @@ public extension SeparatorConfiguration { /// Total height of separator top inset + height + bottom inset. var totalHeight: CGFloat { - return height + insets.top + insets.bottom + height + insets.top + insets.bottom } } diff --git a/Sources/Extensions/Views/ViewText/ViewText+Extensions.swift b/Sources/Extensions/Views/ViewText/ViewText+Extensions.swift index 3d48edd0..5f1b8072 100644 --- a/Sources/Extensions/Views/ViewText/ViewText+Extensions.swift +++ b/Sources/Extensions/Views/ViewText/ViewText+Extensions.swift @@ -67,9 +67,9 @@ public extension ViewText { func size(maxWidth: CGFloat = CGFloat.greatestFiniteMagnitude, maxHeight: CGFloat = CGFloat.greatestFiniteMagnitude) -> CGSize { - return attributedString.boundingRect(with: CGSize(width: maxWidth, height: maxHeight), - options: [.usesLineFragmentOrigin, .usesFontLeading], - context: nil).size + attributedString.boundingRect(with: CGSize(width: maxWidth, height: maxHeight), + options: [.usesLineFragmentOrigin, .usesFontLeading], + context: nil).size } /// Configures given ViewTextConfigurable instance. diff --git a/Sources/Functions/Any+TypeName.swift b/Sources/Functions/Any+TypeName.swift index 28d76110..3fd021ad 100644 --- a/Sources/Functions/Any+TypeName.swift +++ b/Sources/Functions/Any+TypeName.swift @@ -27,5 +27,5 @@ import Foundation /// - Parameter type: an class type /// - Returns: string representation of class type public func typeName(of type: T.Type) -> String { - return String(describing: type) + String(describing: type) } diff --git a/Sources/Protocols/AlertRepresentable.swift b/Sources/Protocols/AlertRepresentable.swift index 548f6e60..d06c8af3 100644 --- a/Sources/Protocols/AlertRepresentable.swift +++ b/Sources/Protocols/AlertRepresentable.swift @@ -35,6 +35,6 @@ public protocol AlertRepresentable { public extension AlertRepresentable { /// By default actionTitles contains single action title var actionTitles: [String] { - return [actionTitle] + [actionTitle] } } diff --git a/Sources/Protocols/Drawing/DrawingOperation.swift b/Sources/Protocols/Drawing/DrawingOperation.swift index 5b1d7d78..ee25e4f1 100644 --- a/Sources/Protocols/Drawing/DrawingOperation.swift +++ b/Sources/Protocols/Drawing/DrawingOperation.swift @@ -43,6 +43,6 @@ public protocol DrawingOperation { extension DrawingOperation { var opaque: Bool { - return false + false } } diff --git a/Sources/Protocols/LoadingIndicator.swift b/Sources/Protocols/LoadingIndicator.swift index 94c9c7a8..c4b6ccf4 100644 --- a/Sources/Protocols/LoadingIndicator.swift +++ b/Sources/Protocols/LoadingIndicator.swift @@ -30,7 +30,7 @@ public protocol LoadingIndicatorHolder: class { public extension LoadingIndicatorHolder where Self: UIView { var indicatorOwner: UIView { - return self + self } } diff --git a/Sources/Protocols/ResettableType.swift b/Sources/Protocols/ResettableType.swift index cb17c135..9716ab00 100644 --- a/Sources/Protocols/ResettableType.swift +++ b/Sources/Protocols/ResettableType.swift @@ -37,6 +37,6 @@ public extension ResettableType { /// /// - Returns: resseted instance of self func reset() -> Self { - return Self(resetFrom: self) + Self(resetFrom: self) } } diff --git a/Sources/Protocols/SupportProtocol.swift b/Sources/Protocols/SupportProtocol.swift index f8e16ad0..ad3c150e 100644 --- a/Sources/Protocols/SupportProtocol.swift +++ b/Sources/Protocols/SupportProtocol.swift @@ -65,7 +65,7 @@ public extension SupportCompatible { /// Support extensions. static var support: Support.Type { get { - return Support.self + Support.self } set { // swiftlint:disable:this unused_setter_value // this enables using Support to "mutate" base type @@ -75,7 +75,7 @@ public extension SupportCompatible { /// Support extensions. var support: Support { get { - return Support(self) + Support(self) } set { // swiftlint:disable:this unused_setter_value // this enables using Support to "mutate" base object diff --git a/Sources/Structures/DataLoading/PaginationDataLoading/AnyPaginationWrappable.swift b/Sources/Structures/DataLoading/PaginationDataLoading/AnyPaginationWrappable.swift index 3d177ef9..7627cd12 100644 --- a/Sources/Structures/DataLoading/PaginationDataLoading/AnyPaginationWrappable.swift +++ b/Sources/Structures/DataLoading/PaginationDataLoading/AnyPaginationWrappable.swift @@ -30,7 +30,7 @@ public final class AnyPaginationWrappable: PaginationWrappable { public var footerView: UIView? { get { - return footerViewGetter() + footerViewGetter() } set { footerViewSetter(newValue) @@ -39,7 +39,7 @@ public final class AnyPaginationWrappable: PaginationWrappable { public var backgroundView: UIView? { get { - return backgroundViewGetter() + backgroundViewGetter() } set { backgroundViewSetter(newValue) diff --git a/Sources/Structures/DrawingOperations/CALayerDrawingOperation.swift b/Sources/Structures/DrawingOperations/CALayerDrawingOperation.swift index 2dd315ae..c8c264a2 100644 --- a/Sources/Structures/DrawingOperations/CALayerDrawingOperation.swift +++ b/Sources/Structures/DrawingOperations/CALayerDrawingOperation.swift @@ -33,7 +33,7 @@ struct CALayerDrawingOperation: DrawingOperation { } public var contextSize: CGContextSize { - return size.ceiledContextSize + size.ceiledContextSize } public func apply(in context: CGContext) { diff --git a/Sources/Structures/DrawingOperations/ImageDrawingOperation.swift b/Sources/Structures/DrawingOperations/ImageDrawingOperation.swift index 069515f2..888532dd 100644 --- a/Sources/Structures/DrawingOperations/ImageDrawingOperation.swift +++ b/Sources/Structures/DrawingOperations/ImageDrawingOperation.swift @@ -44,7 +44,7 @@ struct ImageDrawingOperation: DrawingOperation { } public var contextSize: CGContextSize { - return newSize.ceiledContextSize + newSize.ceiledContextSize } public func apply(in context: CGContext) { diff --git a/Sources/Structures/DrawingOperations/RotateDrawingOperation.swift b/Sources/Structures/DrawingOperations/RotateDrawingOperation.swift index 6e0a0355..485a4bb6 100644 --- a/Sources/Structures/DrawingOperations/RotateDrawingOperation.swift +++ b/Sources/Structures/DrawingOperations/RotateDrawingOperation.swift @@ -42,7 +42,7 @@ struct RotateDrawingOperation: DrawingOperation { } public var contextSize: CGContextSize { - return translateRect.size.ceiledContextSize + translateRect.size.ceiledContextSize } public func apply(in context: CGContext) { diff --git a/Sources/Structures/DrawingOperations/RoundDrawingOperation.swift b/Sources/Structures/DrawingOperations/RoundDrawingOperation.swift index 50978c69..f1ffb8a8 100644 --- a/Sources/Structures/DrawingOperations/RoundDrawingOperation.swift +++ b/Sources/Structures/DrawingOperations/RoundDrawingOperation.swift @@ -35,7 +35,7 @@ struct RoundDrawingOperation: DrawingOperation { } public var contextSize: CGContextSize { - return imageSize.ceiledContextSize + imageSize.ceiledContextSize } public func apply(in context: CGContext) { diff --git a/Sources/Structures/DrawingOperations/SolidFillDrawingOperation.swift b/Sources/Structures/DrawingOperations/SolidFillDrawingOperation.swift index 4fb0e1bc..5d71ea5c 100644 --- a/Sources/Structures/DrawingOperations/SolidFillDrawingOperation.swift +++ b/Sources/Structures/DrawingOperations/SolidFillDrawingOperation.swift @@ -35,7 +35,7 @@ struct SolidFillDrawingOperation: DrawingOperation { } public var contextSize: CGContextSize { - return (width: width, height: height) + (width: width, height: height) } public func apply(in context: CGContext) { diff --git a/Sources/Structures/DrawingOperations/TemplateDrawingOperation.swift b/Sources/Structures/DrawingOperations/TemplateDrawingOperation.swift index d218ff03..1966aaec 100644 --- a/Sources/Structures/DrawingOperations/TemplateDrawingOperation.swift +++ b/Sources/Structures/DrawingOperations/TemplateDrawingOperation.swift @@ -35,7 +35,7 @@ struct TemplateDrawingOperation: DrawingOperation { } public var contextSize: CGContextSize { - return imageSize.ceiledContextSize + imageSize.ceiledContextSize } public func apply(in context: CGContext) { diff --git a/Sources/Structures/NetworkService/NetworkServiceConfiguration.swift b/Sources/Structures/NetworkService/NetworkServiceConfiguration.swift index fb34f3f5..f55d46a9 100644 --- a/Sources/Structures/NetworkService/NetworkServiceConfiguration.swift +++ b/Sources/Structures/NetworkService/NetworkServiceConfiguration.swift @@ -68,11 +68,11 @@ public extension NetworkServiceConfiguration { /// SessionManager constructed with given parameters (session configuration and trust policies) var sessionManager: SessionManager { - return SessionManager(configuration: sessionConfiguration, - serverTrustManager: ServerTrustManager(allHostsMustBeEvaluated: !serverTrustPolicies.isEmpty, - evaluators: serverTrustPolicies), - acceptableStatusCodes: acceptableStatusCodes, - mappingQueue: DispatchQueue(label: .mappingQueueLabel, qos: .default)) + SessionManager(configuration: sessionConfiguration, + serverTrustManager: ServerTrustManager(allHostsMustBeEvaluated: !serverTrustPolicies.isEmpty, + evaluators: serverTrustPolicies), + acceptableStatusCodes: acceptableStatusCodes, + mappingQueue: DispatchQueue(label: .mappingQueueLabel, qos: .default)) } /// Convenient method to create ApiRequestParameters. @@ -91,12 +91,12 @@ public extension NetworkServiceConfiguration { queryItems: [URLQueryItem]? = nil, requestEncoding: ParameterEncoding? = nil, requestHeaders: HTTPHeaders? = nil) -> ApiRequestParameters { - return ApiRequestParameters(url: baseUrl + relativeUrl, - method: method, - parameters: parameters, - queryItems: queryItems, - encoding: requestEncoding ?? encoding, - headers: requestHeaders) + ApiRequestParameters(url: baseUrl + relativeUrl, + method: method, + parameters: parameters, + queryItems: queryItems, + encoding: requestEncoding ?? encoding, + headers: requestHeaders) } /// Convenient method to create ApiRequestParameters. @@ -115,12 +115,12 @@ public extension NetworkServiceConfiguration { queryItems: [URLQueryItem]? = nil, requestEncoding: ParameterEncoding? = nil, requestHeaders: HTTPHeaders? = nil) -> ApiRequestParameters { - return ApiRequestParameters(url: baseUrl + relativeUrl, - method: method, - parameters: parameters, - queryItems: queryItems, - encoding: requestEncoding ?? encoding, - headers: requestHeaders) + ApiRequestParameters(url: baseUrl + relativeUrl, + method: method, + parameters: parameters, + queryItems: queryItems, + encoding: requestEncoding ?? encoding, + headers: requestHeaders) } } diff --git a/Sources/Structures/Views/AnyLoadingIndicator.swift b/Sources/Structures/Views/AnyLoadingIndicator.swift index eac480bc..cdda404e 100644 --- a/Sources/Structures/Views/AnyLoadingIndicator.swift +++ b/Sources/Structures/Views/AnyLoadingIndicator.swift @@ -46,7 +46,7 @@ public struct AnyLoadingIndicator: Animatable { /// The background view. var view: UIView { - return backgroundView + backgroundView } public func startAnimating() { diff --git a/run_swiftlint.sh b/run_swiftlint.sh index 01c1db02..decb82b6 100644 --- a/run_swiftlint.sh +++ b/run_swiftlint.sh @@ -2,7 +2,7 @@ readonly CONFIG_PATH=${PROJECT_DIR}/build-scripts/xcode/.swiftlint.yml -readonly SWIFTLINT_VERSION=0.31.0 +readonly SWIFTLINT_VERSION=0.39.1 readonly SWIFTLINT_PORTABLE_FILENAME=portable_swiftlint.zip readonly SWIFTLINT_PORTABLE_URL=https://github.com/realm/SwiftLint/releases/download/${SWIFTLINT_VERSION}/${SWIFTLINT_PORTABLE_FILENAME}