Skip to content

Commit

Permalink
Merge pull request #151 from Anviking/swift-4
Browse files Browse the repository at this point in the history
Update project settings for Swift 4
  • Loading branch information
Anviking authored Sep 28, 2017
2 parents 823d071 + edc8c2d commit 95a02fd
Show file tree
Hide file tree
Showing 21 changed files with 76 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: objective-c
xcode_project: Decodable.xcodeproj # path to your xcodeproj folder
osx_image: xcode8
osx_image: xcode9
script:
- xcodebuild build -project Decodable.xcodeproj/ -scheme 'Decodable-iOS' -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.0'
- xcodebuild test -project Decodable.xcodeproj/ -scheme 'Decodable-Mac' ONLY_ACTIVE_ARCH=NO
Expand Down
4 changes: 2 additions & 2 deletions Decodable.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = "Decodable"
s.version = "0.5"
s.version = "0.6.0"
s.summary = "Swift JSON parsing done (more) right"
s.description = "Simple yet powerful object mapping made possible by Swift 2's error handling. Greatly inspired by Argo, but without any functional programming and bizillion operators."
s.homepage = "https://github.com/Anviking/Decodable"
s.license = 'MIT'
s.author = { "Anviking" => "[email protected]" }
s.source = { :git => "https://github.com/Anviking/Decodable.git", :tag => "v#{s.version}" }
s.source = { :git => "https://github.com/Anviking/Decodable.git", :tag => "#{s.version}" }
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.9'
s.tvos.deployment_target = '9.0'
Expand Down
24 changes: 23 additions & 1 deletion Decodable.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = anviking;
TargetAttributes = {
17FB80F61B530FED0012F106 = {
Expand All @@ -480,9 +480,11 @@
};
8FE7B5611B4C9FB900837609 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0900;
};
8FE7B56B1B4C9FB900837609 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0900;
};
D0DC546E1B7814D200F79CB0 = {
CreatedOnToolsVersion = 7.0;
Expand Down Expand Up @@ -884,14 +886,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -941,14 +949,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -1001,6 +1015,8 @@
PRODUCT_NAME = Decodable;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -1022,6 +1038,8 @@
PRODUCT_NAME = Decodable;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -1034,6 +1052,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = anviking.DecodableTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -1047,6 +1067,8 @@
PRODUCT_BUNDLE_IDENTIFIER = anviking.DecodableTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?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/>
</plist>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 3 additions & 0 deletions Tests/ArrayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//

import XCTest
import protocol Decodable.Decodable
import enum Decodable.DecodingError
import struct Decodable.KeyPath
@testable import Decodable

class DecodableArrayTests: XCTestCase {
Expand Down
2 changes: 2 additions & 0 deletions Tests/DecodableExtensionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import XCTest
import protocol Decodable.Decodable
import enum Decodable.DecodingError
@testable import Decodable

class DecodableExtensionTests: XCTestCase {
Expand Down
7 changes: 5 additions & 2 deletions Tests/DecodableOperatorsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import XCTest
import protocol Decodable.Decodable
import enum Decodable.DecodingError
@testable import Decodable

class DecodableOperatorsTests: XCTestCase {
Expand Down Expand Up @@ -121,7 +123,8 @@ class DecodableOperatorsTests: XCTestCase {
print(a as Any)
XCTFail()
} catch let DecodingError.typeMismatch(_, actual, _) {
XCTAssertEqual(String(describing: actual), "_SwiftTypePreservingNSNumber")
let typeString = String(describing: actual)
XCTAssertTrue(typeString.contains("Number"), "\(typeString) should contain NSNumber")
} catch let error {
XCTFail("should not throw \(error)")
}
Expand Down Expand Up @@ -205,7 +208,7 @@ class DecodableOperatorsTests: XCTestCase {
} catch let DecodingError.typeMismatch(expected, actual, metadata) where expected == NSDictionary.self {
// then
XCTAssertTrue(true)
XCTAssertEqual(String(describing: actual), "__NSCFString")
XCTAssertTrue(String(describing: actual).contains("String"))
XCTAssertEqual(metadata.formattedPath, "")
XCTAssertEqual(metadata.object as? NSString, (noDictionary))
} catch let error {
Expand Down
7 changes: 5 additions & 2 deletions Tests/DecodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
//

import XCTest
import protocol Decodable.Decodable
import enum Decodable.DecodingError
import struct Decodable.KeyPath
@testable import Decodable

class DecodableTests: XCTestCase {

private func readJsonFile(_ file: String) -> NSDictionary {
let filePath = (Bundle(for: object_getClass(self)).resourcePath! as NSString).appendingPathComponent(file)
let filePath = (Bundle(for: object_getClass(self)!).resourcePath! as NSString).appendingPathComponent(file)
let jsonString = try! String(contentsOfFile: filePath)
let jsonData = jsonString.data(using: String.Encoding.utf8)!
return try! JSONSerialization.jsonObject(with: jsonData, options: JSONSerialization.ReadingOptions.mutableContainers) as! NSDictionary
Expand Down Expand Up @@ -177,7 +180,7 @@ class DecodableTests: XCTestCase {

func testDecodeRepositoryExampleShouldThrowNoJsonObjectException() {
// given
let filePath = (Bundle(for: object_getClass(self)).resourcePath! as NSString).appendingPathComponent("NoJsonObject.json")
let filePath = (Bundle(for: object_getClass(self)!).resourcePath! as NSString).appendingPathComponent("NoJsonObject.json")
let jsonString = try! String(contentsOfFile: filePath)

// when
Expand Down
5 changes: 4 additions & 1 deletion Tests/DecodeAsOneOfTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
//

import XCTest
import protocol Decodable.Decodable
import enum Decodable.DecodingError
import struct Decodable.KeyPath
@testable import Decodable

class DecodeAsOneOfTests: XCTestCase {

private func readJsonFile(_ file: String) -> NSDictionary {
let filePath = (Bundle(for: object_getClass(self)).resourcePath! as NSString).appendingPathComponent(file)
let filePath = (Bundle(for: object_getClass(self)!).resourcePath! as NSString).appendingPathComponent(file)
print(filePath)
let jsonString = try! String(contentsOfFile: filePath)
let jsonData = jsonString.data(using: String.Encoding.utf8)!
Expand Down
2 changes: 2 additions & 0 deletions Tests/DictionaryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import XCTest
import protocol Decodable.Decodable
import enum Decodable.DecodingError
import Decodable

private struct Color: Decodable, Equatable {
Expand Down
7 changes: 5 additions & 2 deletions Tests/ErrorPathTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import XCTest
import protocol Decodable.Decodable
import enum Decodable.DecodingError
@testable import Decodable

private struct Color: Decodable {
Expand Down Expand Up @@ -70,7 +72,8 @@ class ErrorPathTests: XCTestCase {
do {
_ = try dict => "object" => "repo" => "owner" => "login" as String
} catch let DecodingError.typeMismatch(_, actual, metadata) {
XCTAssertEqual(String(describing: actual), "_SwiftTypePreservingNSNumber")
let typeString = String(describing: actual)
XCTAssertTrue(typeString.contains("Number"), "\(typeString) should contain NSNumber")
XCTAssertEqual(metadata.formattedPath, "object.repo.owner.login")
XCTAssertEqual(metadata.object as? Int, 0)
} catch let error {
Expand All @@ -86,7 +89,7 @@ class ErrorPathTests: XCTestCase {
_ = try Tree.decode(dict)
XCTFail()
} catch let DecodingError.typeMismatch(_, actual, metadata) {
XCTAssertEqual(String(describing: actual), "_SwiftTypePreservingNSNumber")
XCTAssertTrue(String(describing: actual).contains("Number"))
XCTAssertEqual(metadata.formattedPath, "apples.color.name")
} catch let error {
XCTFail("should not throw this exception: \(error)")
Expand Down
3 changes: 3 additions & 0 deletions Tests/KeyPathTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//

import XCTest
import protocol Decodable.Decodable
import enum Decodable.DecodingError
import struct Decodable.KeyPath
@testable import Decodable
class KeyPathTests: XCTestCase {

Expand Down
2 changes: 2 additions & 0 deletions Tests/MissingKeyOperatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import XCTest
import protocol Decodable.Decodable
import enum Decodable.DecodingError
import Decodable

class missingKeyOperatorTests: XCTestCase {
Expand Down
3 changes: 3 additions & 0 deletions Tests/ParseTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

import XCTest
import Foundation
import protocol Decodable.Decodable
import enum Decodable.DecodingError
import struct Decodable.KeyPath
@testable import Decodable

class ParseTests: XCTestCase {
Expand Down
2 changes: 2 additions & 0 deletions Tests/RawRepresentableDecodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import XCTest
import protocol Decodable.Decodable
import enum Decodable.DecodingError
@testable import Decodable

enum CMYKColor: String, Decodable {
Expand Down
3 changes: 3 additions & 0 deletions Tests/Repository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//

import Foundation
import protocol Decodable.Decodable
import enum Decodable.DecodingError
import struct Decodable.KeyPath
@testable import Decodable

struct Owner {
Expand Down
2 changes: 2 additions & 0 deletions Tests/Vehicle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2016 anviking. All rights reserved.
//

import protocol Decodable.Decodable
import enum Decodable.DecodingError
@testable import Decodable

protocol Vehicle {
Expand Down

0 comments on commit 95a02fd

Please sign in to comment.