Skip to content

Commit

Permalink
Remove deprecated API in 4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wongzigii committed Sep 25, 2018
1 parent b51eb54 commit 184c688
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 38 deletions.
37 changes: 0 additions & 37 deletions Source/SwiftyJSON.swift
Expand Up @@ -24,22 +24,6 @@ import Foundation

// MARK: - Error
// swiftlint:disable line_length
/// Error domain
@available(*, deprecated, message: "ErrorDomain is deprecated. Use `SwiftyJSONError.errorDomain` instead.", renamed: "SwiftyJSONError.errorDomain")
public let ErrorDomain: String = "SwiftyJSONErrorDomain"

/// Error code
@available(*, deprecated, message: "ErrorUnsupportedType is deprecated. Use `SwiftyJSONError.unsupportedType` instead.", renamed: "SwiftyJSONError.unsupportedType")
public let ErrorUnsupportedType: Int = 999
@available(*, deprecated, message: "ErrorIndexOutOfBounds is deprecated. Use `SwiftyJSONError.indexOutOfBounds` instead.", renamed: "SwiftyJSONError.indexOutOfBounds")
public let ErrorIndexOutOfBounds: Int = 900
@available(*, deprecated, message: "ErrorWrongType is deprecated. Use `SwiftyJSONError.wrongType` instead.", renamed: "SwiftyJSONError.wrongType")
public let ErrorWrongType: Int = 901
@available(*, deprecated, message: "ErrorNotExist is deprecated. Use `SwiftyJSONError.notExist` instead.", renamed: "SwiftyJSONError.notExist")
public let ErrorNotExist: Int = 500
@available(*, deprecated, message: "ErrorInvalidJSON is deprecated. Use `SwiftyJSONError.invalidJSON` instead.", renamed: "SwiftyJSONError.invalidJSON")
public let ErrorInvalidJSON: Int = 490

public enum SwiftyJSONError: Int, Swift.Error {
case unsupportedType = 999
case indexOutOfBounds = 900
Expand Down Expand Up @@ -146,19 +130,6 @@ public struct JSON {
}
}

/**
Creates a JSON from JSON string
- parameter json: Normal json string like '{"a":"b"}'
- returns: The created JSON
*/
@available(*, deprecated, message: "Use instead `init(parseJSON: )`")
public static func parse(_ json: String) -> JSON {
return json.data(using: String.Encoding.utf8)
.flatMap { try? JSON(data: $0) } ?? JSON(NSNull())
}

/**
Creates a JSON using the object.
Expand Down Expand Up @@ -592,14 +563,6 @@ extension JSON: Swift.ExpressibleByArrayLiteral {
}
}

extension JSON: Swift.ExpressibleByNilLiteral {

@available(*, deprecated, message: "use JSON.null instead. Will be removed in future versions")
public init(nilLiteral: ()) {
self.init(NSNull() as Any)
}
}

// MARK: - Raw

extension JSON: Swift.RawRepresentable {
Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftyJSONTests/PerformanceTests.swift
Expand Up @@ -127,7 +127,7 @@ class PerformanceTests: XCTestCase {
self.measure {
autoreleasepool {
if let dictionary = json.dictionary {
XCTAssertTrue(dictionary.count > 0)
XCTAssertTrue(dictionary.count == 100001)
} else {
XCTFail("dictionary should not be nil")
}
Expand Down

0 comments on commit 184c688

Please sign in to comment.