Merge pull request #62 from TouchInstinct/targets
iOS, iOS Extension, watchOS, tvOS targets
This commit is contained in:
commit
9bdbd3ea67
113
LeadKit.podspec
113
LeadKit.podspec
|
|
@ -5,16 +5,109 @@ Pod::Spec.new do |s|
|
|||
s.homepage = "https://github.com/TouchInstinct/LeadKit"
|
||||
s.license = "Apache License, Version 2.0"
|
||||
s.author = "Touch Instinct"
|
||||
s.platform = :ios, "9.0"
|
||||
s.source = { :git => "https://github.com/TouchInstinct/LeadKit.git", :tag => s.version }
|
||||
s.source_files = "LeadKit/LeadKit/**/*.swift"
|
||||
s.platform = :ios, '9.0'
|
||||
|
||||
s.subspec 'UIColorHex' do |ss|
|
||||
ss.ios.deployment_target = '8.0'
|
||||
ss.tvos.deployment_target = '9.0'
|
||||
ss.watchos.deployment_target = '2.0'
|
||||
|
||||
ss.source_files = "LeadKit/Sources/Extensions/UIColor/UIColor+Hex.swift"
|
||||
end
|
||||
|
||||
s.subspec 'Drawing' do |ss|
|
||||
# ss.ios.deployment_target = '8.0' # can't get it work: DrawingOperation.swift:29:17: note: did you mean 'DrawingOperation'?
|
||||
# ss.tvos.deployment_target = '9.0' # can't get it work: DrawingOperation.swift:29:17: note: did you mean 'DrawingOperation'?
|
||||
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/*",
|
||||
]
|
||||
ss.watchos.exclude_files = [
|
||||
"LeadKit/Sources/Structures/Drawing/CALayerDrawingOperation.swift",
|
||||
"LeadKit/Sources/Extensions/UIImage/*",
|
||||
]
|
||||
end
|
||||
|
||||
s.subspec 'Core' do |ss|
|
||||
ss.ios.deployment_target = '9.0'
|
||||
ss.tvos.deployment_target = '9.0'
|
||||
ss.watchos.deployment_target = '2.0'
|
||||
|
||||
ss.source_files = "LeadKit/Sources/**/*.swift"
|
||||
ss.watchos.exclude_files = [
|
||||
"LeadKit/Sources/Classes/Pagination/PaginationTableViewWrapper.swift",
|
||||
"LeadKit/Sources/Classes/Views/XibView.swift",
|
||||
"LeadKit/Sources/Extensions/CGFloat/CGFloat+Pixels.swift",
|
||||
"LeadKit/Sources/Extensions/NetworkService/NetworkService+ActivityIndicator.swift",
|
||||
"LeadKit/Sources/Extensions/NetworkService/NetworkService+RxLoadImage.swift",
|
||||
"LeadKit/Sources/Extensions/Observable/Observable+ToastErrorLogging.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/UIActivityIndicator/UIActivityIndicator+LoadingIndicator.swift",
|
||||
"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",
|
||||
]
|
||||
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/Observable/Observable+ToastErrorLogging.swift",
|
||||
"LeadKit/Sources/Extensions/PaginationTableViewWrapperDelegate/PaginationTableViewWrapperDelegate+DefaultImplementation.swift",
|
||||
"LeadKit/Sources/Extensions/Support/UIScrollView+Support.swift",
|
||||
"LeadKit/Sources/Extensions/TableDirector/TableDirector+Extensions.swift",
|
||||
]
|
||||
|
||||
ss.dependency "CocoaLumberjack/Swift", '~> 3.1.0'
|
||||
ss.dependency "RxSwift", '3.4.0'
|
||||
ss.dependency "RxCocoa", '3.4.0'
|
||||
ss.dependency "RxAlamofire", '3.0.2'
|
||||
ss.dependency "ObjectMapper", '~> 2.2'
|
||||
|
||||
ss.ios.dependency "Toast-Swift", '~> 2.0.0'
|
||||
ss.ios.dependency "TableKit", '~> 2.3.1'
|
||||
ss.ios.dependency "UIScrollView-InfiniteScroll", '~> 1.0.0'
|
||||
end
|
||||
|
||||
s.subspec 'Core-iOS-Extension' do |ss|
|
||||
ss.platform = :ios, '9.0'
|
||||
|
||||
ss.source_files = "LeadKit/Sources/**/*.swift"
|
||||
|
||||
ss.exclude_files = [
|
||||
"LeadKit/Sources/Classes/Pagination/PaginationTableViewWrapper.swift",
|
||||
"LeadKit/Sources/Extensions/NetworkService/NetworkService+ActivityIndicator.swift",
|
||||
"LeadKit/Sources/Extensions/Observable/Observable+ToastErrorLogging.swift",
|
||||
"LeadKit/Sources/Extensions/PaginationTableViewWrapperDelegate/PaginationTableViewWrapperDelegate+DefaultImplementation.swift",
|
||||
"LeadKit/Sources/Extensions/TableDirector/TableDirector+Extensions.swift",
|
||||
]
|
||||
|
||||
ss.pod_target_xcconfig = { 'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'LEADKIT_EXTENSION_TARGET' }
|
||||
|
||||
ss.dependency "CocoaLumberjack/Swift", '~> 3.1.0'
|
||||
ss.dependency "RxSwift", '3.4.0'
|
||||
ss.dependency "RxCocoa", '3.4.0'
|
||||
ss.dependency "RxAlamofire", '3.0.2'
|
||||
ss.dependency "ObjectMapper", '~> 2.2'
|
||||
end
|
||||
|
||||
s.default_subspec = 'Core'
|
||||
|
||||
s.dependency "CocoaLumberjack/Swift", '~> 3.1.0'
|
||||
s.dependency "RxSwift", '3.2.0'
|
||||
s.dependency "RxCocoa", '3.2.0'
|
||||
s.dependency "RxAlamofire", '3.0.0'
|
||||
s.dependency "ObjectMapper", '~> 2.1'
|
||||
s.dependency "Toast-Swift", '~> 2.0.0'
|
||||
s.dependency "TableKit", '~> 2.3.1'
|
||||
s.dependency "UIScrollView-InfiniteScroll", '~> 1.0.0'
|
||||
end
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,99 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "78CFEE291C5C456B00F50370"
|
||||
BuildableName = "LeadKit.framework"
|
||||
BlueprintName = "LeadKit"
|
||||
ReferencedContainer = "container:LeadKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "78CFEE331C5C456B00F50370"
|
||||
BuildableName = "LeadKitTests.xctest"
|
||||
BlueprintName = "LeadKitTests"
|
||||
ReferencedContainer = "container:LeadKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "78CFEE291C5C456B00F50370"
|
||||
BuildableName = "LeadKit.framework"
|
||||
BlueprintName = "LeadKit"
|
||||
ReferencedContainer = "container:LeadKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "78CFEE291C5C456B00F50370"
|
||||
BuildableName = "LeadKit.framework"
|
||||
BlueprintName = "LeadKit"
|
||||
ReferencedContainer = "container:LeadKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "78CFEE291C5C456B00F50370"
|
||||
BuildableName = "LeadKit.framework"
|
||||
BlueprintName = "LeadKit"
|
||||
ReferencedContainer = "container:LeadKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
import LeadKit
|
||||
|
||||
let str = "Hello, LeadKit playground"
|
||||
|
|
@ -1,21 +1,57 @@
|
|||
# Uncomment the next line to define a global platform for your project
|
||||
platform :ios, '9.0'
|
||||
|
||||
target 'LeadKit' do
|
||||
use_frameworks!
|
||||
|
||||
abstract_target 'LeadKit' do
|
||||
pod "CocoaLumberjack/Swift", '~> 3.1.0'
|
||||
pod "RxSwift", '3.2.0'
|
||||
pod "RxCocoa", '3.2.0'
|
||||
pod "RxAlamofire", '3.0.0'
|
||||
pod "ObjectMapper", '~> 2.1'
|
||||
pod "Toast-Swift", '~> 2.0.0'
|
||||
pod "TableKit", '~> 2.3.1'
|
||||
pod "UIScrollView-InfiniteScroll", '~> 1.0.0'
|
||||
pod "RxSwift", '3.4.0'
|
||||
pod "RxCocoa", '3.4.0'
|
||||
pod "RxAlamofire", '3.0.2'
|
||||
pod "ObjectMapper", '~> 2.2'
|
||||
|
||||
inhibit_all_warnings!
|
||||
|
||||
target 'LeadKit iOS' do
|
||||
platform :ios, '9.0'
|
||||
|
||||
use_frameworks!
|
||||
|
||||
pod "Toast-Swift", '~> 2.0.0'
|
||||
pod "TableKit", '~> 2.3.1'
|
||||
pod "UIScrollView-InfiniteScroll", '~> 1.0.0'
|
||||
|
||||
target 'LeadKit iOSTests' do
|
||||
inherit! :search_paths
|
||||
# Pods for testing
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
target 'LeadKit iOS Extensions' do
|
||||
platform :ios, '9.0'
|
||||
|
||||
use_frameworks!
|
||||
|
||||
target 'LeadKit iOS ExtensionsTests' do
|
||||
inherit! :search_paths
|
||||
# Pods for testing
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
target 'LeadKit watchOS' do
|
||||
platform :watchos, '2.0'
|
||||
|
||||
use_frameworks!
|
||||
|
||||
end
|
||||
|
||||
target 'LeadKit tvOS' do
|
||||
platform :tvos, '9.0'
|
||||
|
||||
use_frameworks!
|
||||
|
||||
target 'LeadKit tvOSTests' do
|
||||
inherit! :search_paths
|
||||
# Pods for testing
|
||||
end
|
||||
|
||||
target 'LeadKitTests' do
|
||||
inherit! :search_paths
|
||||
# Pods for testing
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,25 +3,25 @@ PODS:
|
|||
- CocoaLumberjack/Default (3.1.0)
|
||||
- CocoaLumberjack/Swift (3.1.0):
|
||||
- CocoaLumberjack/Default
|
||||
- ObjectMapper (2.2.5)
|
||||
- RxAlamofire (3.0.0):
|
||||
- RxAlamofire/Core (= 3.0.0)
|
||||
- RxAlamofire/Core (3.0.0):
|
||||
- ObjectMapper (2.2.6)
|
||||
- RxAlamofire (3.0.2):
|
||||
- RxAlamofire/Core (= 3.0.2)
|
||||
- RxAlamofire/Core (3.0.2):
|
||||
- Alamofire (~> 4.0)
|
||||
- RxSwift (~> 3.0)
|
||||
- RxCocoa (3.2.0):
|
||||
- RxSwift (~> 3.1)
|
||||
- RxSwift (3.2.0)
|
||||
- RxCocoa (3.4.0):
|
||||
- RxSwift (~> 3.4)
|
||||
- RxSwift (3.4.0)
|
||||
- TableKit (2.3.1)
|
||||
- Toast-Swift (2.0.0)
|
||||
- UIScrollView-InfiniteScroll (1.0.0)
|
||||
- UIScrollView-InfiniteScroll (1.0.1)
|
||||
|
||||
DEPENDENCIES:
|
||||
- CocoaLumberjack/Swift (~> 3.1.0)
|
||||
- ObjectMapper (~> 2.1)
|
||||
- RxAlamofire (= 3.0.0)
|
||||
- RxCocoa (= 3.2.0)
|
||||
- RxSwift (= 3.2.0)
|
||||
- ObjectMapper (~> 2.2)
|
||||
- RxAlamofire (= 3.0.2)
|
||||
- RxCocoa (= 3.4.0)
|
||||
- RxSwift (= 3.4.0)
|
||||
- TableKit (~> 2.3.1)
|
||||
- Toast-Swift (~> 2.0.0)
|
||||
- UIScrollView-InfiniteScroll (~> 1.0.0)
|
||||
|
|
@ -29,14 +29,14 @@ DEPENDENCIES:
|
|||
SPEC CHECKSUMS:
|
||||
Alamofire: dc44b1600b800eb63da6a19039a0083d62a6a62d
|
||||
CocoaLumberjack: 8311463ddf9ee86a06ef92a071dd656c89244500
|
||||
ObjectMapper: fb30f71e08470d1e5a20b199fafe1246281db898
|
||||
RxAlamofire: 0b1fa48f545fffe7f7a28af2086bcaa3b5946cc9
|
||||
RxCocoa: ccdf43101a70407097a29082f648ba1676075b30
|
||||
RxSwift: 46574f70d416b7923c237195939cc488a7fbf3a0
|
||||
ObjectMapper: 042708195cc46c20871cbcbec0453826398273fd
|
||||
RxAlamofire: bc53604b29fd2d220cfaa490c736cc4500819f34
|
||||
RxCocoa: d14ef6b6029e1ddc6e966508c09289090de68ff9
|
||||
RxSwift: 3789a1af753002a14edecdb698a2424624296a9c
|
||||
TableKit: 02e041b443f75fa3e9f1ee6024d4b256305bd904
|
||||
Toast-Swift: 5b2f8f720f7e78e48511f693df1f9c9a6e38a25a
|
||||
UIScrollView-InfiniteScroll: d26885be71caca7485cdb37eab513a8f89036bb0
|
||||
UIScrollView-InfiniteScroll: a90df4ba4a7ca1926128ade34a850ddbdf74c564
|
||||
|
||||
PODFILE CHECKSUM: 0e4c2bc8339733ce0009cdae7684c9cdf03a9be0
|
||||
PODFILE CHECKSUM: cf6dcd073cc362b0d897b5b68e5c2c16c982d072
|
||||
|
||||
COCOAPODS: 1.2.0
|
||||
COCOAPODS: 1.2.1
|
||||
|
|
|
|||
|
|
@ -31,17 +31,12 @@ import RxAlamofire
|
|||
/// and shows errors in DEBUG mode
|
||||
open class NetworkService {
|
||||
|
||||
private let disposeBag = DisposeBag()
|
||||
private let requestCount = Variable<Int>(0)
|
||||
private let requestCountVariable = Variable<Int>(0)
|
||||
|
||||
public let sessionManager: Alamofire.SessionManager
|
||||
|
||||
/// Let netwrok service automatically show / hide activity indicator
|
||||
public func bindActivityIndicator() {
|
||||
return requestCount.asDriver()
|
||||
.map { $0 != 0 }
|
||||
.drive(UIApplication.shared.rx.isNetworkActivityIndicatorVisible)
|
||||
.addDisposableTo(disposeBag)
|
||||
var requestCount: Driver<Int> {
|
||||
return requestCountVariable.asDriver()
|
||||
}
|
||||
|
||||
/// Creates new instance of NetworkService with given Alamofire session manager
|
||||
|
|
@ -58,9 +53,18 @@ open class NetworkService {
|
|||
public func rxRequest<T: ObservableMappable>(with parameters: ApiRequestParameters)
|
||||
-> Observable<(response: HTTPURLResponse, model: T)> where T.ModelType == T {
|
||||
|
||||
return sessionManager.rx.responseObservableModel(requestParameters: parameters)
|
||||
.counterTracking(for: self)
|
||||
.showErrorsInToastInDebugMode()
|
||||
let responseObservable = sessionManager.rx.responseObservableModel(requestParameters: parameters)
|
||||
.counterTracking(for: self) as Observable<(response: HTTPURLResponse, model: T)>
|
||||
|
||||
#if os(iOS)
|
||||
#if LEADKIT_EXTENSION_TARGET
|
||||
return responseObservable
|
||||
#else
|
||||
return responseObservable.showErrorsInToastInDebugMode()
|
||||
#endif
|
||||
#else
|
||||
return responseObservable
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Perform reactive request to get mapped ImmutableMappable model and http response
|
||||
|
|
@ -70,33 +74,26 @@ open class NetworkService {
|
|||
public func rxRequest<T: ImmutableMappable>(with parameters: ApiRequestParameters)
|
||||
-> Observable<(response: HTTPURLResponse, model: T)> {
|
||||
|
||||
return sessionManager.rx.responseModel(requestParameters: parameters)
|
||||
.counterTracking(for: self)
|
||||
.showErrorsInToastInDebugMode()
|
||||
}
|
||||
let responseObservable = sessionManager.rx.responseModel(requestParameters: parameters)
|
||||
.counterTracking(for: self) as Observable<(response: HTTPURLResponse, model: T)>
|
||||
|
||||
/// Perform reactive request to get UIImage and http response
|
||||
///
|
||||
/// - Parameter url: An object adopting `URLConvertible`
|
||||
/// - Returns: Observable of tuple containing (HTTPURLResponse, UIImage?)
|
||||
public func rxLoadImage(url: String) -> Observable<(HTTPURLResponse, UIImage?)> {
|
||||
let request = RxAlamofire.requestData(.get, url, headers: [:])
|
||||
|
||||
return request
|
||||
.observeOn(ConcurrentDispatchQueueScheduler(qos: .background))
|
||||
.map { (response, data) -> (HTTPURLResponse, UIImage?) in
|
||||
(response, UIImage(data: data))
|
||||
}
|
||||
.counterTracking(for: self)
|
||||
.showErrorsInToastInDebugMode()
|
||||
#if os(iOS)
|
||||
#if LEADKIT_EXTENSION_TARGET
|
||||
return responseObservable
|
||||
#else
|
||||
return responseObservable.showErrorsInToastInDebugMode()
|
||||
#endif
|
||||
#else
|
||||
return responseObservable
|
||||
#endif
|
||||
}
|
||||
|
||||
fileprivate func increaseRequestCounter() {
|
||||
requestCount.value += 1
|
||||
requestCountVariable.value += 1
|
||||
}
|
||||
|
||||
fileprivate func decreaseRequestCounter() {
|
||||
requestCount.value -= 1
|
||||
requestCountVariable.value -= 1
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -31,7 +31,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: ImmutableMappable>(mappingQueue: DispatchQueue = DispatchQueue.global())
|
||||
func apiResponse<T: ImmutableMappable>(mappingQueue: DispatchQueue = .global())
|
||||
-> Observable<(response: HTTPURLResponse, model: T)> {
|
||||
|
||||
return responseJSONOnQueue(mappingQueue)
|
||||
|
|
@ -46,7 +46,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: ImmutableMappable>(mappingQueue: DispatchQueue = DispatchQueue.global())
|
||||
func apiResponse<T: ImmutableMappable>(mappingQueue: DispatchQueue = .global())
|
||||
-> Observable<(response: HTTPURLResponse, models: [T])> {
|
||||
|
||||
return responseJSONOnQueue(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 = DispatchQueue.global())
|
||||
func apiResponse<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 = DispatchQueue.global())
|
||||
func apiResponse<T: ObservableMappable>(mappingQueue: DispatchQueue = .global())
|
||||
-> Observable<(response: HTTPURLResponse, models: [T])> where T.ModelType == T {
|
||||
|
||||
return responseJSONOnQueue(mappingQueue)
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
//
|
||||
// Copyright (c) 2017 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import RxSwift
|
||||
|
||||
extension NetworkService {
|
||||
|
||||
/// Let netwrok service automatically show / hide activity indicator
|
||||
public func bindActivityIndicator() -> Disposable {
|
||||
return requestCount
|
||||
.map { $0 != 0 }
|
||||
.drive(UIApplication.shared.rx.isNetworkActivityIndicatorVisible)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
//
|
||||
// Copyright (c) 2017 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import RxSwift
|
||||
import RxAlamofire
|
||||
|
||||
public extension NetworkService {
|
||||
|
||||
/// Perform reactive request to get UIImage and http response
|
||||
///
|
||||
/// - Parameter url: An object adopting `URLConvertible`
|
||||
/// - Returns: Observable of tuple containing (HTTPURLResponse, UIImage?)
|
||||
public func rxLoadImage(url: String) -> Observable<(HTTPURLResponse, UIImage?)> {
|
||||
let request = RxAlamofire.requestData(.get, url, headers: [:])
|
||||
|
||||
let requestObservable = request
|
||||
.observeOn(ConcurrentDispatchQueueScheduler(qos: .background))
|
||||
.map { (response, data) -> (HTTPURLResponse, UIImage?) in
|
||||
(response, UIImage(data: data))
|
||||
}
|
||||
.counterTracking(for: self)
|
||||
|
||||
#if os(iOS)
|
||||
#if LEADKIT_EXTENSION_TARGET
|
||||
return requestObservable
|
||||
#else
|
||||
return requestObservable.showErrorsInToastInDebugMode()
|
||||
#endif
|
||||
#else
|
||||
return requestObservable
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Foundation
|
||||
|
||||
public extension StoryboardProtocol {
|
||||
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
import UIKit
|
||||
|
||||
@available(iOS 10.0, *)
|
||||
@available(iOS 10.0, tvOS 10.0, *)
|
||||
public extension UIImage {
|
||||
|
||||
/// Creates an image filled by given color.
|
||||
|
|
@ -221,7 +221,7 @@ public extension UIImage {
|
|||
|
||||
}
|
||||
|
||||
@available(iOS 10.0, *)
|
||||
@available(iOS 10.0, tvOS 10.0, *)
|
||||
private extension DrawingOperation {
|
||||
|
||||
func imageFromNewRenderer(scale: CGFloat) -> UIImage {
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
// Copyright (c) 2017 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
|
|
@ -20,29 +20,8 @@
|
|||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
public protocol ConfigurableController {
|
||||
|
||||
associatedtype ViewModelT
|
||||
|
||||
var viewModel: ViewModelT { get }
|
||||
|
||||
func bindViews()
|
||||
|
||||
func addViews()
|
||||
|
||||
func setAppearance()
|
||||
|
||||
func configureBarButtons()
|
||||
|
||||
func localize()
|
||||
|
||||
func initialLoadView()
|
||||
|
||||
}
|
||||
|
||||
extension ConfigurableController where Self: UIViewController {
|
||||
|
||||
public func bindViews() {
|
||||
|
|
@ -29,20 +29,15 @@ public extension UIWindow {
|
|||
/// default root controller animation duration
|
||||
static let snapshotAnimationDuration = 0.5
|
||||
|
||||
/**
|
||||
method changes root controller in window and sets status bar style
|
||||
|
||||
- parameter controller: new root controller
|
||||
- parameter statusBarStyle: new status bar style
|
||||
*/
|
||||
public func changeRootController(controller: UIViewController,
|
||||
statusBarStyle: UIStatusBarStyle) {
|
||||
/// Method changes root controller in window.
|
||||
///
|
||||
/// - Parameter controller: New root controller.
|
||||
public func changeRootController(controller: UIViewController) {
|
||||
animateRootViewControllerChanging(controller: controller)
|
||||
|
||||
rootViewController?.dismiss(animated: false, completion: nil)
|
||||
rootViewController = controller
|
||||
makeKeyAndVisible()
|
||||
UIApplication.shared.statusBarStyle = statusBarStyle
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -15,9 +15,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.4.7</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<string>0.5.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.5.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.5.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.5.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// Copyright (c) 2017 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Protocol that ensures that specific type support basic animation actions.
|
||||
public protocol Animatable {
|
||||
|
||||
/// Method that starts animation.
|
||||
func startAnimating()
|
||||
/// Method that stops animation.
|
||||
func stopAnimating()
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// Copyright (c) 2017 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol ConfigurableController {
|
||||
|
||||
associatedtype ViewModelT
|
||||
|
||||
var viewModel: ViewModelT { get }
|
||||
|
||||
func bindViews()
|
||||
|
||||
func addViews()
|
||||
|
||||
func setAppearance()
|
||||
|
||||
func configureBarButtons()
|
||||
|
||||
func localize()
|
||||
|
||||
func initialLoadView()
|
||||
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreGraphics
|
||||
|
||||
/**
|
||||
* protocol which ensures that specific type can return estimated height of view for view model
|
||||
|
|
@ -22,16 +22,6 @@
|
|||
|
||||
import UIKit
|
||||
|
||||
/// Protocol that ensures that specific type support basic animation actions.
|
||||
public protocol Animatable {
|
||||
|
||||
/// Method that starts animation.
|
||||
func startAnimating()
|
||||
/// Method that stops animation.
|
||||
func stopAnimating()
|
||||
|
||||
}
|
||||
|
||||
/// Protocol that describes badic loading indicator.
|
||||
public protocol LoadingIndicator {
|
||||
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreGraphics
|
||||
|
||||
/**
|
||||
* protocol which ensures that specific type can return estimated height of view
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreGraphics
|
||||
|
||||
/**
|
||||
* protocol which ensures that specific type can return height of view
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreGraphics
|
||||
|
||||
/**
|
||||
* protocol which ensures that specific type can return height of view for view model
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue