Merge pull request #73 from TouchInstinct/change-project-structure
change project structure and integrate code quality
This commit is contained in:
commit
f3b24792ad
|
|
@ -73,3 +73,5 @@ fastlane/screenshots
|
|||
.idea/workspace.xml
|
||||
.idea/tasks.xml
|
||||
|
||||
cpd-output.xml
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "code-quality"]
|
||||
path = code-quality
|
||||
url = https://github.com/TouchInstinct/code-quality-ios
|
||||
|
|
@ -0,0 +1 @@
|
|||
code-quality/.swiftlint.yml
|
||||
|
|
@ -0,0 +1 @@
|
|||
code-quality/.tailor.yml
|
||||
|
|
@ -13,7 +13,7 @@ Pod::Spec.new do |s|
|
|||
ss.tvos.deployment_target = '9.0'
|
||||
ss.watchos.deployment_target = '2.0'
|
||||
|
||||
ss.source_files = "LeadKit/Sources/Extensions/UIColor/UIColor+Hex.swift"
|
||||
ss.source_files = "Sources/Extensions/UIColor/UIColor+Hex.swift"
|
||||
end
|
||||
|
||||
s.subspec 'Drawing' do |ss|
|
||||
|
|
@ -22,14 +22,14 @@ Pod::Spec.new do |s|
|
|||
ss.watchos.deployment_target = '2.0'
|
||||
|
||||
ss.source_files = [
|
||||
"LeadKit/Sources/Enums/ResizeContentMode.swift",
|
||||
"LeadKit/Sources/Extensions/{CGContext,CGImage,CGSize,UIImage}/*",
|
||||
"LeadKit/Sources/Protocols/{DrawingOperation,SupportProtocol}.swift",
|
||||
"LeadKit/Sources/Structures/Drawing/*",
|
||||
"Sources/Enums/ResizeContentMode.swift",
|
||||
"Sources/Extensions/{CGContext,CGImage,CGSize,UIImage}/*",
|
||||
"Sources/Protocols/{DrawingOperation,SupportProtocol}.swift",
|
||||
"Sources/Structures/Drawing/*",
|
||||
]
|
||||
ss.watchos.exclude_files = [
|
||||
"LeadKit/Sources/Structures/Drawing/CALayerDrawingOperation.swift",
|
||||
"LeadKit/Sources/Extensions/UIImage/*",
|
||||
"Sources/Structures/Drawing/CALayerDrawingOperation.swift",
|
||||
"Sources/Extensions/UIImage/*",
|
||||
]
|
||||
end
|
||||
|
||||
|
|
@ -38,42 +38,42 @@ Pod::Spec.new do |s|
|
|||
ss.tvos.deployment_target = '9.0'
|
||||
ss.watchos.deployment_target = '2.0'
|
||||
|
||||
ss.source_files = "LeadKit/Sources/**/*.swift"
|
||||
ss.source_files = "Sources/**/*.swift"
|
||||
ss.watchos.exclude_files = [
|
||||
"LeadKit/Sources/Classes/Pagination/PaginationTableViewWrapper.swift",
|
||||
"LeadKit/Sources/Classes/Views/XibView.swift",
|
||||
"LeadKit/Sources/Classes/Views/SpinnerView.swift",
|
||||
"LeadKit/Sources/Extensions/CABasicAnimation/*",
|
||||
"LeadKit/Sources/Extensions/CGFloat/CGFloat+Pixels.swift",
|
||||
"LeadKit/Sources/Extensions/NetworkService/NetworkService+ActivityIndicator.swift",
|
||||
"LeadKit/Sources/Extensions/NetworkService/NetworkService+RxLoadImage.swift",
|
||||
"LeadKit/Sources/Extensions/PaginationTableViewWrapperDelegate/PaginationTableViewWrapperDelegate+DefaultImplementation.swift",
|
||||
"LeadKit/Sources/Extensions/StoryboardProtocol/*",
|
||||
"LeadKit/Sources/Extensions/Support/UIScrollView+Support.swift",
|
||||
"LeadKit/Sources/Extensions/TableDirector/TableDirector+Extensions.swift",
|
||||
"LeadKit/Sources/Extensions/UIActivityIndicatorView/*",
|
||||
"LeadKit/Sources/Extensions/UIAlertcontroller/*",
|
||||
"LeadKit/Sources/Extensions/UICollectionView/*",
|
||||
"LeadKit/Sources/Extensions/UIDevice/*",
|
||||
"LeadKit/Sources/Extensions/UIImage/*",
|
||||
"LeadKit/Sources/Extensions/UIStoryboard/*",
|
||||
"LeadKit/Sources/Extensions/UIView/*",
|
||||
"LeadKit/Sources/Extensions/UIViewController/*",
|
||||
"LeadKit/Sources/Extensions/UIWindow/*",
|
||||
"LeadKit/Sources/Protocols/LoadingIndicator.swift",
|
||||
"LeadKit/Sources/Protocols/StoryboardProtocol.swift",
|
||||
"LeadKit/Sources/Structures/Views/AnyLoadingIndicator.swift",
|
||||
"LeadKit/Sources/Structures/DrawingOperations/CALayerDrawingOperation.swift",
|
||||
"LeadKit/Sources/Structures/DrawingOperations/RoundDrawingOperation.swift",
|
||||
"LeadKit/Sources/Structures/DrawingOperations/BorderDrawingOperation.swift",
|
||||
"Sources/Classes/Pagination/PaginationTableViewWrapper.swift",
|
||||
"Sources/Classes/Views/XibView.swift",
|
||||
"Sources/Classes/Views/SpinnerView.swift",
|
||||
"Sources/Extensions/CABasicAnimation/*",
|
||||
"Sources/Extensions/CGFloat/CGFloat+Pixels.swift",
|
||||
"Sources/Extensions/NetworkService/NetworkService+ActivityIndicator.swift",
|
||||
"Sources/Extensions/NetworkService/NetworkService+RxLoadImage.swift",
|
||||
"Sources/Extensions/PaginationTableViewWrapperDelegate/PaginationTableViewWrapperDelegate+DefaultImplementation.swift",
|
||||
"Sources/Extensions/StoryboardProtocol/*",
|
||||
"Sources/Extensions/Support/UIScrollView+Support.swift",
|
||||
"Sources/Extensions/TableDirector/TableDirector+Extensions.swift",
|
||||
"Sources/Extensions/UIActivityIndicatorView/*",
|
||||
"Sources/Extensions/UIAlertcontroller/*",
|
||||
"Sources/Extensions/UICollectionView/*",
|
||||
"Sources/Extensions/UIDevice/*",
|
||||
"Sources/Extensions/UIImage/*",
|
||||
"Sources/Extensions/UIStoryboard/*",
|
||||
"Sources/Extensions/UIView/*",
|
||||
"Sources/Extensions/UIViewController/*",
|
||||
"Sources/Extensions/UIWindow/*",
|
||||
"Sources/Protocols/LoadingIndicator.swift",
|
||||
"Sources/Protocols/StoryboardProtocol.swift",
|
||||
"Sources/Structures/Views/AnyLoadingIndicator.swift",
|
||||
"Sources/Structures/DrawingOperations/CALayerDrawingOperation.swift",
|
||||
"Sources/Structures/DrawingOperations/RoundDrawingOperation.swift",
|
||||
"Sources/Structures/DrawingOperations/BorderDrawingOperation.swift",
|
||||
]
|
||||
ss.tvos.exclude_files = [
|
||||
"LeadKit/Sources/Classes/Pagination/PaginationTableViewWrapper.swift",
|
||||
"LeadKit/Sources/Structures/Drawing/CALayerDrawingOperation.swift",
|
||||
"LeadKit/Sources/Extensions/NetworkService/NetworkService+ActivityIndicator.swift",
|
||||
"LeadKit/Sources/Extensions/PaginationTableViewWrapperDelegate/PaginationTableViewWrapperDelegate+DefaultImplementation.swift",
|
||||
"LeadKit/Sources/Extensions/Support/UIScrollView+Support.swift",
|
||||
"LeadKit/Sources/Extensions/TableDirector/TableDirector+Extensions.swift",
|
||||
"Sources/Classes/Pagination/PaginationTableViewWrapper.swift",
|
||||
"Sources/Structures/Drawing/CALayerDrawingOperation.swift",
|
||||
"Sources/Extensions/NetworkService/NetworkService+ActivityIndicator.swift",
|
||||
"Sources/Extensions/PaginationTableViewWrapperDelegate/PaginationTableViewWrapperDelegate+DefaultImplementation.swift",
|
||||
"Sources/Extensions/Support/UIScrollView+Support.swift",
|
||||
"Sources/Extensions/TableDirector/TableDirector+Extensions.swift",
|
||||
]
|
||||
|
||||
ss.dependency "CocoaLumberjack/Swift", '~> 3.1.0'
|
||||
|
|
@ -89,13 +89,13 @@ Pod::Spec.new do |s|
|
|||
s.subspec 'Core-iOS-Extension' do |ss|
|
||||
ss.platform = :ios, '9.0'
|
||||
|
||||
ss.source_files = "LeadKit/Sources/**/*.swift"
|
||||
ss.source_files = "Sources/**/*.swift"
|
||||
|
||||
ss.exclude_files = [
|
||||
"LeadKit/Sources/Classes/Pagination/PaginationTableViewWrapper.swift",
|
||||
"LeadKit/Sources/Extensions/NetworkService/NetworkService+ActivityIndicator.swift",
|
||||
"LeadKit/Sources/Extensions/PaginationTableViewWrapperDelegate/PaginationTableViewWrapperDelegate+DefaultImplementation.swift",
|
||||
"LeadKit/Sources/Extensions/TableDirector/TableDirector+Extensions.swift",
|
||||
"Sources/Classes/Pagination/PaginationTableViewWrapper.swift",
|
||||
"Sources/Extensions/NetworkService/NetworkService+ActivityIndicator.swift",
|
||||
"Sources/Extensions/PaginationTableViewWrapperDelegate/PaginationTableViewWrapperDelegate+DefaultImplementation.swift",
|
||||
"Sources/Extensions/TableDirector/TableDirector+Extensions.swift",
|
||||
]
|
||||
|
||||
ss.dependency "CocoaLumberjack/Swift", '~> 3.1.0'
|
||||
|
|
|
|||
|
|
@ -1252,6 +1252,7 @@
|
|||
buildConfigurationList = 67186B391EB248F100CFAFFB /* Build configuration list for PBXNativeTarget "LeadKit iOS" */;
|
||||
buildPhases = (
|
||||
8AB4AD16371A6CA62765A6E7 /* [CP] Check Pods Manifest.lock */,
|
||||
67887A0E1ECC856F008A9E1D /* CopyPaste Detection */,
|
||||
67186C2D1EB2537A00CFAFFB /* Tailor */,
|
||||
67186C2E1EB2538E00CFAFFB /* SwiftLint */,
|
||||
67186B231EB248F100CFAFFB /* Sources */,
|
||||
|
|
@ -1698,6 +1699,20 @@
|
|||
shellPath = /bin/sh;
|
||||
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"SwiftLint does not exist, download from https://github.com/realm/SwiftLint\"\nfi";
|
||||
};
|
||||
67887A0E1ECC856F008A9E1D /* CopyPaste Detection */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "CopyPaste Detection";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Running CPD\npmd cpd --files Sources --minimum-tokens 50 --language swift --encoding UTF-8 --format net.sourceforge.pmd.cpd.XMLRenderer > cpd-output.xml --failOnViolation true\n\n# Running script\nphp ./cpd_script.php -cpd-xml cpd-output.xml";
|
||||
};
|
||||
6C0CE35AC797D005DF06F7D5 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
disabled_rules:
|
||||
- variable_name
|
||||
excluded:
|
||||
- Carthage
|
||||
- Pods
|
||||
line_length: 128
|
||||
type_body_length:
|
||||
- 500 # warning
|
||||
- 700 # error
|
||||
file_length:
|
||||
warning: 500
|
||||
error: 1200
|
||||
warning_threshold: 1
|
||||
|
||||
custom_rules:
|
||||
uiwebview_disabled:
|
||||
included: ".*.swift"
|
||||
name: "UIWebView Usage Disabled"
|
||||
regex: "(UIWebView)"
|
||||
message: "Do not use UIWebView. Use WKWebView Instead. https://developer.apple.com/reference/uikit/uiwebview"
|
||||
severity: error
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
exclude:
|
||||
- 'Pods'
|
||||
- 'Carthage'
|
||||
- 'RxAlamofire'
|
||||
|
|
@ -13,7 +13,6 @@ PODS:
|
|||
- RxSwift (~> 3.4)
|
||||
- RxSwift (3.4.0)
|
||||
- TableKit (2.3.1)
|
||||
- Toast-Swift (2.0.0)
|
||||
- UIScrollView-InfiniteScroll (1.0.1)
|
||||
|
||||
DEPENDENCIES:
|
||||
|
|
@ -23,7 +22,6 @@ DEPENDENCIES:
|
|||
- RxCocoa (= 3.4.0)
|
||||
- RxSwift (= 3.4.0)
|
||||
- TableKit (~> 2.3.1)
|
||||
- Toast-Swift (~> 2.0.0)
|
||||
- UIScrollView-InfiniteScroll (~> 1.0.0)
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
|
|
@ -34,9 +32,8 @@ SPEC CHECKSUMS:
|
|||
RxCocoa: d14ef6b6029e1ddc6e966508c09289090de68ff9
|
||||
RxSwift: 3789a1af753002a14edecdb698a2424624296a9c
|
||||
TableKit: 02e041b443f75fa3e9f1ee6024d4b256305bd904
|
||||
Toast-Swift: 5b2f8f720f7e78e48511f693df1f9c9a6e38a25a
|
||||
UIScrollView-InfiniteScroll: a90df4ba4a7ca1926128ade34a850ddbdf74c564
|
||||
|
||||
PODFILE CHECKSUM: cf6dcd073cc362b0d897b5b68e5c2c16c982d072
|
||||
PODFILE CHECKSUM: 911be4683d2ba9315350d42e9576f7517da3f756
|
||||
|
||||
COCOAPODS: 1.2.1
|
||||
|
|
@ -152,7 +152,7 @@ where Delegate.Cursor == Cursor {
|
|||
.addDisposableTo(disposeBag)
|
||||
}
|
||||
|
||||
// MARK: States handling
|
||||
// MARK - States handling
|
||||
|
||||
private func onInitialState() {
|
||||
//
|
||||
|
|
@ -255,7 +255,7 @@ where Delegate.Cursor == Cursor {
|
|||
currentPlaceholderView = emptyView
|
||||
}
|
||||
|
||||
// MARK: private stuff
|
||||
// MARK - private stuff
|
||||
|
||||
private func onExhaustedState() {
|
||||
removeInfiniteScroll()
|
||||
|
|
@ -28,7 +28,6 @@ import RxAlamofire
|
|||
|
||||
/// Base network service implementation build on top of LeadKit extensions for Alamofire.
|
||||
/// Has an ability to automatically show / hide network activity indicator
|
||||
/// and shows errors in DEBUG mode
|
||||
open class NetworkService {
|
||||
|
||||
private let requestCountVariable = Variable<Int>(0)
|
||||
|
|
@ -80,7 +80,7 @@ class SpinnerView: UIView, Animatable, LoadingIndicator {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: Animatable
|
||||
// MARK - Animatable
|
||||
|
||||
func startAnimating() {
|
||||
guard !animating else {
|
||||
|
|
@ -106,7 +106,7 @@ class SpinnerView: UIView, Animatable, LoadingIndicator {
|
|||
removeAnimation()
|
||||
}
|
||||
|
||||
// MARK: private stuff
|
||||
// MARK - private stuff
|
||||
|
||||
private func addAnimation() {
|
||||
guard let imageView = imageView else {
|
||||
|
|
@ -45,7 +45,7 @@ open class XibView: UIView {
|
|||
}
|
||||
|
||||
private func setupView() {
|
||||
let view: UIView = UIView.loadFromNib(named: innerViewNibName, owner: self)
|
||||
let view = UIView.loadFromNib(named: innerViewNibName, owner: self) as UIView
|
||||
|
||||
// Make frame size match the size of the content view in the xib
|
||||
frame = CGRect(origin: frame.origin, size: view.frame.size)
|
||||
|
|
@ -45,7 +45,7 @@ public extension Reactive where Base: Alamofire.SessionManager {
|
|||
/// - Parameter mappingQueue: The dispatch queue to use for mapping
|
||||
/// - Returns: Observable with HTTP URL Response and target object
|
||||
func responseModel<T: ImmutableMappable>(requestParameters: ApiRequestParameters,
|
||||
mappingQueue: DispatchQueue = DispatchQueue.global())
|
||||
mappingQueue: DispatchQueue = .global())
|
||||
-> Observable<(response: HTTPURLResponse, model: T)> {
|
||||
|
||||
return apiRequest(requestParameters: requestParameters)
|
||||
|
|
@ -58,7 +58,7 @@ public extension Reactive where Base: Alamofire.SessionManager {
|
|||
/// - Parameter mappingQueue: The dispatch queue to use for mapping
|
||||
/// - Returns: Observable with HTTP URL Response and array of target objects
|
||||
func responseModel<T: ImmutableMappable>(requestParameters: ApiRequestParameters,
|
||||
mappingQueue: DispatchQueue = DispatchQueue.global())
|
||||
mappingQueue: DispatchQueue = .global())
|
||||
-> Observable<(response: HTTPURLResponse, models: [T])> {
|
||||
|
||||
return apiRequest(requestParameters: requestParameters)
|
||||
|
|
@ -71,11 +71,11 @@ public extension Reactive where Base: Alamofire.SessionManager {
|
|||
/// - Parameter mappingQueue: The dispatch queue to use for mapping
|
||||
/// - Returns: Observable with HTTP URL Response and target object
|
||||
func responseObservableModel<T: ObservableMappable>(requestParameters: ApiRequestParameters,
|
||||
mappingQueue: DispatchQueue = DispatchQueue.global())
|
||||
mappingQueue: DispatchQueue = .global())
|
||||
-> Observable<(response: HTTPURLResponse, model: T)> where T.ModelType == T {
|
||||
|
||||
return apiRequest(requestParameters: requestParameters)
|
||||
.flatMap { $0.validate().rx.apiResponse(mappingQueue: mappingQueue) }
|
||||
.flatMap { $0.validate().rx.observableApiResponse(mappingQueue: mappingQueue) }
|
||||
}
|
||||
|
||||
/// Method which executes request and serializes response into array of target objects
|
||||
|
|
@ -84,11 +84,11 @@ public extension Reactive where Base: Alamofire.SessionManager {
|
|||
/// - Parameter mappingQueue: The dispatch queue to use for mapping
|
||||
/// - Returns: Observable with HTTP URL Response and array of target objects
|
||||
func responseObservableModel<T: ObservableMappable>(requestParameters: ApiRequestParameters,
|
||||
mappingQueue: DispatchQueue = DispatchQueue.global())
|
||||
mappingQueue: DispatchQueue = .global())
|
||||
-> Observable<(response: HTTPURLResponse, models: [T])> where T.ModelType == T {
|
||||
|
||||
return apiRequest(requestParameters: requestParameters)
|
||||
.flatMap { $0.validate().rx.apiResponse(mappingQueue: mappingQueue) }
|
||||
.flatMap { $0.validate().rx.observableApiResponse(mappingQueue: mappingQueue) }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ public extension Reactive where Base: DataRequest {
|
|||
///
|
||||
/// - Parameter mappingQueue: The dispatch queue to use for mapping
|
||||
/// - Returns: Observable with HTTP URL Response and target object
|
||||
func apiResponse<T: ObservableMappable>(mappingQueue: DispatchQueue = .global())
|
||||
func observableApiResponse<T: ObservableMappable>(mappingQueue: DispatchQueue = .global())
|
||||
-> Observable<(response: HTTPURLResponse, model: T)> where T.ModelType == T {
|
||||
|
||||
return responseJSONOnQueue(mappingQueue)
|
||||
|
|
@ -77,7 +77,7 @@ public extension Reactive where Base: DataRequest {
|
|||
///
|
||||
/// - Parameter mappingQueue: The dispatch queue to use for mapping
|
||||
/// - Returns: Observable with HTTP URL Response and array of target objects
|
||||
func apiResponse<T: ObservableMappable>(mappingQueue: DispatchQueue = .global())
|
||||
func observableApiResponse<T: ObservableMappable>(mappingQueue: DispatchQueue = .global())
|
||||
-> Observable<(response: HTTPURLResponse, models: [T])> where T.ModelType == T {
|
||||
|
||||
return responseJSONOnQueue(mappingQueue)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue