Skip to content

Commit

Permalink
Migration to Swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
aronbalog committed Dec 11, 2018
1 parent b5e94e3 commit 7f69b85
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.2
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
os: osx
osx_image: xcode9.2
osx_image: xcode10.1
language: swift
before_install:
- pod repo update > /dev/null
script:
- set -o pipefail
- xcodebuild test -workspace Vox.xcworkspace -scheme Vox -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.2' ONLY_ACTIVE_ARCH=NO
- xcodebuild test -workspace Vox.xcworkspace -scheme Vox -destination 'platform=iOS Simulator,name=iPhone 8,OS=12.0' ONLY_ACTIVE_ARCH=NO
- pod lib lint
after_success:
- bash <(curl -s https://codecov.io/bash) -J 'Vox'
12 changes: 6 additions & 6 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- Alamofire (4.7.0)
- Nimble (7.0.3)
- Quick (1.2.0)
- Alamofire (4.8.0)
- Nimble (7.3.1)
- Quick (1.3.2)

DEPENDENCIES:
- Alamofire (~> 4.7)
Expand All @@ -15,9 +15,9 @@ SPEC REPOS:
- Quick

SPEC CHECKSUMS:
Alamofire: 907e0a98eb68cdb7f9d1f541a563d6ac5dc77b25
Nimble: 7f5a9c447a33002645a071bddafbfb24ea70e0ac
Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08
Alamofire: 3ec537f71edc9804815215393ae2b1a8ea33a844
Nimble: 04f732da099ea4d153122aec8c2a88fd0c7219ae
Quick: 2623cb30d7a7f41ca62f684f679586558f483d46

PODFILE CHECKSUM: d6370329bd52b0306d7c72b4a2cf75a0248944c9

Expand Down
2 changes: 1 addition & 1 deletion Vox.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'Vox'
spec.version = '1.2.0'
spec.version = '1.2.1'
spec.license = 'MIT'
spec.summary = 'A Swift JSONAPI framework'
spec.author = 'Aron Balog'
Expand Down
128 changes: 72 additions & 56 deletions Vox.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions Vox.xcodeproj/xcshareddata/xcschemes/Vox.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,9 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -57,7 +56,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 2 additions & 2 deletions Vox/Core/Class/Context.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Context: NSObject {
let resource = mapResource(for: data)
dataType = .resource(resource)
} else if let data = dictionary["data"] as? NSMutableArray {
let resources = data.flatMap({ (resourceData) -> Resource? in
let resources = data.compactMap({ (resourceData) -> Resource? in
guard let dictionary = resourceData as? NSMutableDictionary else { fatalError("Invalid data type") }
let resource = mapResource(for: dictionary)

Expand All @@ -40,7 +40,7 @@ public class Context: NSObject {

dataType = .collection(resources)
} else if let errors = dictionary["errors"] as? NSMutableArray {
let errorObjects = errors.flatMap({ (object) -> ErrorObject? in
let errorObjects = errors.compactMap({ (object) -> ErrorObject? in
guard let object = object as? [String: Any] else { return nil }
return ErrorObject(dictionary: object)
})
Expand Down
2 changes: 1 addition & 1 deletion Vox/Core/Class/Context_Query.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension Context {
let data = relationshipDocumentData["data"]
if let arrayOfBasicObjects = data as? NSMutableArray {

value = arrayOfBasicObjects.flatMap({ (basicObject) -> Resource? in
value = arrayOfBasicObjects.compactMap({ (basicObject) -> Resource? in
return resourcePool.resource(forBasicObject: basicObject as! [String: String])
})
} else if let basicObject = data as? NSMutableDictionary {
Expand Down
2 changes: 1 addition & 1 deletion Vox/Core/Networking/Protocol/FetchPageable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public extension Document where DataType: Collection, DataType.Element: Resource
if let array = document.context.dictionary["data"] as? [Any] {
let selfData = self.context.dictionary["data"] as? NSMutableArray

let resources = array.flatMap({ (resourceJson) -> Resource? in
let resources = array.compactMap({ (resourceJson) -> Resource? in
guard let resourceJson = resourceJson as? NSMutableDictionary else { return nil }
let copy = resourceJson.mutableCopy() as! NSMutableDictionary

Expand Down

0 comments on commit 7f69b85

Please sign in to comment.