Skip to content

Commit

Permalink
Merge 195d990 into 90c7f12
Browse files Browse the repository at this point in the history
  • Loading branch information
sprzenus committed Aug 14, 2020
2 parents 90c7f12 + 195d990 commit 03b48dd
Show file tree
Hide file tree
Showing 51 changed files with 52 additions and 53 deletions.
4 changes: 1 addition & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "Restler",
platforms: [
.iOS(.v11),
.iOS(.v10),
.macOS(.v10_15)
],
products: [
Expand Down
2 changes: 1 addition & 1 deletion Restler-Example/Restler-Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
final class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
Expand Down
2 changes: 1 addition & 1 deletion Restler-Example/Restler-Example/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import SwiftUI

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
final class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftUI
import Combine
import Restler

class CommentViewModel: ObservableObject {
final class CommentViewModel: ObservableObject {
private let restler = Restler(baseURL: URL(string: "https://jsonplaceholder.typicode.com")!)
private let comment: PostComment
private var tasks: Set<Restler.Task> = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftUI
import Combine
import Restler

class ContentViewModel: ObservableObject {
final class ContentViewModel: ObservableObject {
private let restler = Restler(baseURL: URL(string: "https://jsonplaceholder.typicode.com")!)

private var subscriptions: [AnyCancellable] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import Combine
import Restler

class PostViewModel: ObservableObject {
final class PostViewModel: ObservableObject {
private let restler = Restler(baseURL: URL(string: "https://jsonplaceholder.typicode.com")!)

let objectWillChange = PassthroughSubject<Void, Never>()
Expand Down
2 changes: 1 addition & 1 deletion Sources/Restler/Internal/DispatchQueueManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ protocol DispatchQueueManagerType: class {
func perform(on thread: DispatchQueueThread, _ syncType: DispatchQueueSynchronizationType, action: @escaping () -> Void)
}

class DispatchQueueManager: DispatchQueueManagerType {
final class DispatchQueueManager: DispatchQueueManagerType {
func perform(on thread: DispatchQueueThread, _ synchType: DispatchQueueSynchronizationType, action: @escaping () -> Void) {
switch synchType {
case .async: thread.queue.async(execute: action)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ protocol JSONSerializationType: class {
func jsonObject(with data: Data, options opt: JSONSerialization.ReadingOptions) throws -> Any
}

class CustomJSONSerialization: JSONSerializationType {
final class CustomJSONSerialization: JSONSerializationType {
func jsonObject(with data: Data, options: JSONSerialization.ReadingOptions) throws -> Any {
return try JSONSerialization.jsonObject(with: data, options: options)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Restler/Internal/Networking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protocol NetworkingType: class {
) -> URLSession.DataTaskPublisher?
}

class Networking {
final class Networking {
private let session: URLSessionType

// MARK: - Initialization
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

extension Restler {
public class MultipartEncoder: RestlerMultipartEncoderType {
public final class MultipartEncoder: RestlerMultipartEncoderType {
internal static let lineBreak = "\r\n"

private var containers: [RestlerMultipartSectionsType] = []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

extension Restler.MultipartEncoder {
public class Container<Key: CodingKey>: RestlerMultipartContainerType {
public final class Container<Key: CodingKey>: RestlerMultipartContainerType {
internal var sections: [Restler.MultipartSection] = []

// MARK: - Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

extension Restler {
public class QueryEncoder: RestlerQueryEncoderType {
public final class QueryEncoder: RestlerQueryEncoderType {
private let jsonEncoder: RestlerJSONEncoderType

private var containers: [QueryItemsRepresentable] = []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

extension Restler.QueryEncoder {
public class KeyedContainer<Key: CodingKey>: RestlerQueryEncoderContainerType {
public final class KeyedContainer<Key: CodingKey>: RestlerQueryEncoderContainerType {
private let jsonEncoder: RestlerJSONEncoderType

internal var tuples: [(key: String, value: String)] = []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

extension Restler.QueryEncoder {
public class StringKeyedContainer: RestlerQueryEncoderContainerType {
public final class StringKeyedContainer: RestlerQueryEncoderContainerType {
// swiftlint:disable:next nesting
public typealias Key = String

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

extension Restler {
public class DecodableRequest<D: Decodable>: Request<D>, RestlerRequestInternal {
public final class DecodableRequest<D: Decodable>: Request<D>, RestlerRequestInternal {
internal let dependencies: Restler.RequestDependencies

private var successCompletionHandler: ((D) -> Void)?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

extension Restler {
public class OptionalDecodableRequest<D: Decodable>: Request<D?>, RestlerRequestInternal {
public final class OptionalDecodableRequest<D: Decodable>: Request<D?>, RestlerRequestInternal {
internal let dependencies: Restler.RequestDependencies

private var successCompletionHandler: ((D?) -> Void)?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
typealias QueryParametersType = [URLQueryItem]

extension Restler {
public class RequestBuilder {
public final class RequestBuilder {
private let dependencies: Dependencies
private var form: Form

Expand Down
2 changes: 1 addition & 1 deletion Sources/Restler/Public/Classes/Request/VoidRequest.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

extension Restler {
public class VoidRequest: Request<Void>, RestlerRequestInternal {
public final class VoidRequest: Request<Void>, RestlerRequestInternal {
internal let dependencies: Restler.RequestDependencies

private var successCompletionHandler: ((SuccessfulResponseObject) -> Void)?
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Common/TestError.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

class TestError: Error {}
final class TestError: Error {}

// MARK: - Equatable
extension TestError: Equatable {
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Common/ThrowingObject.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import Restler

class ThrowingObject: Codable, RestlerQueryEncodable, RestlerMultipartEncodable {
final class ThrowingObject: Codable, RestlerQueryEncodable, RestlerMultipartEncodable {
var thrownError: Error = TestError()

init() {}
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Mocks/CustomJSONSerializationMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
@testable import Restler

class CustomJSONSerializationMock {
final class CustomJSONSerializationMock {

// MARK: - JSONSerializationType
var jsonObjectThrownError: Error?
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Mocks/DispatchQueueManagerMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
@testable import Restler

class DispatchQueueManagerMock {
final class DispatchQueueManagerMock {

// MARK: - DispatchQueueManagerType
private(set) var performParams: [PerformParams] = []
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Mocks/Errors/DecodableErrorMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
@testable import Restler

class DecodableErrorMock: RestlerErrorDecodable {
final class DecodableErrorMock: RestlerErrorDecodable {
required init?(response _: Restler.Response) {}
}

2 changes: 1 addition & 1 deletion Tests/RestlerTests/Mocks/Errors/UndecodableErrorMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
@testable import Restler

class UndecodableErrorMock: RestlerErrorDecodable {
final class UndecodableErrorMock: RestlerErrorDecodable {
required init?(response _: Restler.Response) {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Mocks/HTTPURLResponseMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
@testable import Restler

class HTTPURLResponseMock {
final class HTTPURLResponseMock {

// MARK: - HTTPURLResponseType
var isSuccessfulReturnValue: Bool = true
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Mocks/JSONEncoderThrowingMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
@testable import Restler

class JSONEncoderThrowingMock: RestlerJSONEncoderType {
final class JSONEncoderThrowingMock: RestlerJSONEncoderType {
var thrownError = TestError()

func encode<T>(_ value: T) throws -> Data where T: Encodable {
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Mocks/NetworkingMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
@testable import Restler

class NetworkingMock {
final class NetworkingMock {

// MARK: - NetworkingType
var makeRequestReturnValue: Restler.Task?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import Restler

class RestlerErrorParserMock {
final class RestlerErrorParserMock {

// MARK: - RestlerErrorParserType
var decodingErrorsReturnValue: [RestlerErrorDecodable.Type] = []
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Mocks/Public/RestlerMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import Restler

class RestlerMock {
final class RestlerMock {
var encoder: RestlerJSONEncoderType = JSONEncoder()

var decoder: RestlerJSONDecoderType = JSONDecoder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
import Restler

class RestlerRequestBuilderMock {
final class RestlerRequestBuilderMock {

// MARK: - RestlerBasicRequestBuilderType
private(set) var setInHeaderParams: [SetInHeaderParams] = []
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Mocks/Public/RestlerRequestMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import Restler

class RestlerRequestMock<T>: Restler.Request<T> {
final class RestlerRequestMock<T>: Restler.Request<T> {

private(set) var onSuccessParams: [OnSuccessParams] = []
struct OnSuccessParams {
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Mocks/URLSessionDataTaskMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
@testable import Restler

class URLSessionDataTaskMock {
final class URLSessionDataTaskMock {

// MARK: - URLSessionDataTaskType
var taskIdentifierReturnValue: Int = 0
Expand Down
3 changes: 2 additions & 1 deletion Tests/RestlerTests/Mocks/URLSessionMock.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
@testable import Restler

class URLSessionMock {
final class URLSessionMock {

// MARK: - URLSessionType
var dataTaskReturnValue: URLSessionDataTaskMock = URLSessionDataTaskMock()
Expand All @@ -24,6 +24,7 @@ extension URLSessionMock: URLSessionType {
return self.dataTaskReturnValue
}

@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
func dataTaskPublisher(for request: URLRequest) -> URLSession.DataTaskPublisher {
self.dataTaskPublisherParams.append(DataTaskPublisherParams(request: request))
return URLSession.shared.dataTaskPublisher(for: request)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
@testable import Restler

class DeleteInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}
final class DeleteInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}

// MARK: - Void response
extension DeleteInterfaceIntegrationTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
@testable import Restler

class GetInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}
final class GetInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}

// MARK: - Void response
extension GetInterfaceIntegrationTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
@testable import Restler

class HeadInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}
final class HeadInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}

// MARK: - Void response
extension HeadInterfaceIntegrationTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import XCTest
@testable import Restler

class PatchInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}
final class PatchInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}

// MARK: - Void response
extension PatchInterfaceIntegrationTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
@testable import Restler

class PostInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}
final class PostInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}

// MARK: - Void response
extension PostInterfaceIntegrationTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
@testable import Restler

class PutInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}
final class PutInterfaceIntegrationTests: InterfaceIntegrationTestsBase {}

// MARK: - Void response
extension PutInterfaceIntegrationTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
@testable import Restler

class QueryEncoderIntegrationTests: XCTestCase {}
final class QueryEncoderIntegrationTests: XCTestCase {}

extension QueryEncoderIntegrationTests {
func testEncoding_stringDictionary() throws {
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Tests/RestlerInterfaceMocksTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
import Restler

class RestlerInterfaceMocksTests: XCTestCase {
final class RestlerInterfaceMocksTests: XCTestCase {
private var restler: RestlerMock!

override func setUp() {
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Tests/Unit/ErrorParserTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
@testable import Restler

class ErrorParserTests: XCTestCase {}
final class ErrorParserTests: XCTestCase {}

// MARK: - parse(_:)
extension ErrorParserTests {
Expand Down
2 changes: 1 addition & 1 deletion Tests/RestlerTests/Tests/Unit/ErrorTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTest
@testable import Restler

class ErrorTests: XCTestCase {}
final class ErrorTests: XCTestCase {}

// MARK: - Equatable
extension ErrorTests {
Expand Down

0 comments on commit 03b48dd

Please sign in to comment.