diff --git a/.ci/buildkite/pipeline.template.yml b/.ci/buildkite/pipeline.template.yml index e7d0b9e..4dfdbf2 100755 --- a/.ci/buildkite/pipeline.template.yml +++ b/.ci/buildkite/pipeline.template.yml @@ -1,4 +1,7 @@ steps: + - + name: ":muscle: Lint" + command: .ci/scripts/lint - name: ":fastlane: Test Mac OS X" command: .ci/scripts/test-osx @@ -12,7 +15,7 @@ steps: - type: "waiter" - - name: ":codecov: Send Coverage" + name: ":muscle: Send Coverage" command: .ci/scripts/send-coverage agents: name: "$BUILDKITE_AGENT_META_DATA_NAME" diff --git a/.ci/scripts/lint b/.ci/scripts/lint new file mode 100755 index 0000000..35a8be9 --- /dev/null +++ b/.ci/scripts/lint @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +source /usr/local/opt/chruby/share/chruby/chruby.sh +chruby ruby +bundle exec fastlane lint diff --git a/.ci/scripts/send-coverage b/.ci/scripts/send-coverage index 187dc92..a1678bb 100755 --- a/.ci/scripts/send-coverage +++ b/.ci/scripts/send-coverage @@ -1,2 +1,4 @@ #!/usr/bin/env bash -bash <(curl -s https://codecov.io/bash) -D .fastlane/xcodebuild-data \ No newline at end of file +source /usr/local/opt/chruby/share/chruby/chruby.sh +chruby ruby +bundle exec slather coverage --scheme "ValueCoding-iOS" --buildkite --coveralls --build-directory .ci/xcodebuild-data \ No newline at end of file diff --git a/.fastlane/Fastfile b/.fastlane/Fastfile index ea124fc..a269d86 100644 --- a/.fastlane/Fastfile +++ b/.fastlane/Fastfile @@ -1,4 +1,11 @@ -default_platform :ios +lane :lint do + + swiftLint( + mode: :lint, + config_file: '.swiftlint.yml' + ) +end + platform :ios do diff --git a/.jazzy.yaml b/.jazzy.yml similarity index 88% rename from .jazzy.yaml rename to .jazzy.yml index 94e7442..1436aa7 100644 --- a/.jazzy.yaml +++ b/.jazzy.yml @@ -1,12 +1,12 @@ author_name: Daniel Thorpe author_url: http://danthorpe.me module_name: ValueCoding -module_version: 1.2.0 +module_version: 1.3.0 github_url: https://github.com/danthorpe/ValueCoding readme: README.md podspec: ValueCoding.podspec -swift_version: 2.1.1 +swift_version: 2.2 xcodebuild-arguments: -scheme,ValueCoding-iOS custom_categories: diff --git a/.slather.yml b/.slather.yml new file mode 100644 index 0000000..e75e4ff --- /dev/null +++ b/.slather.yml @@ -0,0 +1,6 @@ +coverage_service: coveralls +xcodeproj: ValueCoding.xcodeproj +build_directory: .ci/xcodebuild-data +ignore: + - Tests/* + - Supporting Files/* \ No newline at end of file diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..adb98f0 --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,3 @@ +disabled_rules: + - line_length + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e53bb76..956b84b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.3.0 +1. [[VCD-13](https://github.com/danthorpe/ValueCoding/pull/13)]: Switches test coverage reporting to Coveralls. Also adds SwiftLint rules into the project and CI. +2. [[VCD-14](https://github.com/danthorpe/ValueCoding/pull/14)]: Updates to Swift 2.2 syntax. :) + # 1.2.0 1. [[VCD-9, VCD-10](https://github.com/danthorpe/ValueCoding/pull/10)]: Adds support for a single level of nesting inside SequenceType values. For example it is now possible to encode and decode `[[Foo]]` structures where `Foo` conforms to `ValueCoding`. diff --git a/Gemfile b/Gemfile index 3f17113..1133efe 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,6 @@ source 'https://rubygems.org' +gem 'slather' gem 'scan' gem 'fastlane', '>= 1.35' gem 'xcpretty' diff --git a/Gemfile.lock b/Gemfile.lock index 4f975ac..9a0ab7b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,41 +1,37 @@ GEM remote: https://rubygems.org/ specs: - activesupport (4.2.5) + activesupport (4.2.6) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.3.8) - autoparse (0.3.3) - addressable (>= 2.3.1) - extlib (>= 0.9.15) - multi_json (>= 1.0.0) babosa (1.0.2) - cert (1.2.7) - fastlane_core (>= 0.26.4, < 1.0.0) - spaceship (>= 0.15.1, < 1.0.0) + cert (1.4.0) + fastlane_core (>= 0.29.1, < 1.0.0) + spaceship (>= 0.22.0, < 1.0.0) claide (0.9.1) - coderay (1.1.0) + clamp (0.6.5) colored (1.2) commander (4.3.5) highline (~> 1.7.2) - credentials_manager (0.13.0) + credentials_manager (0.15.0) colored + commander (>= 4.3.5) highline (>= 1.7.1) security - deliver (1.6.6) + deliver (1.10.5) credentials_manager (>= 0.12.0, < 1.0.0) fastimage (~> 1.6) - fastlane_core (>= 0.31.0, < 1.0.0) + fastlane_core (>= 0.37.0, < 1.0.0) plist (~> 3.1.0) - spaceship (>= 0.19.0, <= 1.0.0) - domain_name (0.5.25) + spaceship (>= 0.19.0, < 1.0.0) + domain_name (0.5.20160310) unf (>= 0.0.5, < 1.0.0) - dotenv (2.0.2) + dotenv (2.1.0) excon (0.45.4) - extlib (0.9.16) faraday (0.9.2) multipart-post (>= 1.2, < 3) faraday-cookie_jar (0.0.6) @@ -45,35 +41,35 @@ GEM faraday (>= 0.7.4, < 0.10) fastimage (1.6.8) addressable (~> 2.3, >= 2.3.5) - fastlane (1.49.0) + fastlane (1.67.0) addressable (~> 2.3.8) - cert (>= 1.2.7, < 2.0.0) - credentials_manager (>= 0.13.0, < 1.0.0) - deliver (>= 1.6.5, < 2.0.0) - fastlane_core (>= 0.31.0, < 1.0.0) - frameit (>= 2.4.1, < 3.0.0) - gym (>= 1.1.6, < 2.0.0) + cert (>= 1.4.0, < 2.0.0) + credentials_manager (>= 0.15.0, < 1.0.0) + deliver (>= 1.10.5, < 2.0.0) + fastlane_core (>= 0.37.0, < 1.0.0) + frameit (>= 2.5.1, < 3.0.0) + gym (>= 1.6.2, < 2.0.0) krausefx-shenzhen (>= 0.14.7) - match (>= 0.2.2, < 1.0.0) - pem (>= 1.1.1, < 2.0.0) - pilot (>= 1.2.1, < 2.0.0) + match (>= 0.4.0, < 1.0.0) + pem (>= 1.3.0, < 2.0.0) + pilot (>= 1.4.1, < 2.0.0) plist (~> 3.1.0) - produce (>= 1.1.0, < 2.0.0) - scan (>= 0.3.3, < 1.0.0) - sigh (>= 1.2.1, < 2.0.0) + produce (>= 1.1.1, < 2.0.0) + scan (>= 0.5.2, < 1.0.0) + screengrab (>= 0.3.1, < 1.0.0) + sigh (>= 1.6.0, < 2.0.0) slack-notifier (~> 1.3) - snapshot (>= 1.4.2, < 2.0.0) - spaceship (>= 0.18.1, < 1.0.0) - supply (>= 0.2.2, < 1.0.0) + snapshot (>= 1.12.0, < 2.0.0) + spaceship (>= 0.24.0, < 1.0.0) + supply (>= 0.4.0, < 1.0.0) terminal-notifier (~> 1.6.2) terminal-table (~> 1.4.5) - xcode-install (~> 1.0.1) - xcodeproj (>= 0.20, < 1.0.0) + xcodeproj (>= 0.20, < 2.0.0) xcpretty (>= 0.2.1) - fastlane_core (0.32.0) + fastlane_core (0.39.0) babosa colored - commander (>= 4.3.5) + commander (= 4.3.5) credentials_manager (>= 0.11.0, < 1.0.0) excon (~> 0.45.0) highline (>= 1.7.2) @@ -83,31 +79,31 @@ GEM rubyzip (~> 1.1.6) sentry-raven (~> 0.15) terminal-table (~> 1.4.5) - frameit (2.4.1) + frameit (2.5.1) deliver (> 0.3) fastimage (~> 1.6.3) - fastlane_core (>= 0.16.0, < 1.0.0) + fastlane_core (>= 0.36.1, < 1.0.0) mini_magick (~> 4.0.2) - google-api-client (0.8.6) - activesupport (>= 3.2) + google-api-client (0.9.4) addressable (~> 2.3) - autoparse (~> 0.3) - extlib (~> 0.9) - faraday (~> 0.9) - googleauth (~> 0.3) - launchy (~> 2.4) - multi_json (~> 1.10) - retriable (~> 1.4) - signet (~> 0.6) - googleauth (0.5.0) + googleauth (~> 0.5) + httpclient (~> 2.7) + hurley (~> 0.1) + memoist (~> 0.11) + mime-types (>= 1.6) + representable (~> 2.3.0) + retriable (~> 2.0) + thor (~> 0.19) + googleauth (0.5.1) faraday (~> 0.9) jwt (~> 1.4) logging (~> 2.0) memoist (~> 0.12) multi_json (~> 1.11) + os (~> 0.9) signet (~> 0.7) - gym (1.2.0) - fastlane_core (>= 0.25.0, < 1.0.0) + gym (1.6.2) + fastlane_core (>= 0.36.1, < 1.0.0) plist rubyzip (>= 1.1.7) terminal-table @@ -115,9 +111,11 @@ GEM highline (1.7.8) http-cookie (1.0.2) domain_name (~> 0.5) + httpclient (2.7.1) + hurley (0.2) i18n (0.7.0) json (1.8.3) - jwt (1.5.2) + jwt (1.5.3) krausefx-shenzhen (0.14.7) commander (~> 4.3) dotenv (>= 0.7) @@ -130,74 +128,81 @@ GEM rubyzip (~> 1.1) security (~> 0.1.3) terminal-table (~> 1.4.5) - launchy (2.4.3) - addressable (~> 2.3) little-plugger (1.1.4) - logging (2.0.0) + logging (2.1.0) little-plugger (~> 1.1) multi_json (~> 1.10) - match (0.2.3) - cert (>= 1.2.7, < 2.0.0) + match (0.4.0) + cert (>= 1.2.8, < 2.0.0) credentials_manager (>= 0.13.0, < 1.0.0) - fastlane_core (>= 0.31.0, < 1.0.0) + fastlane_core (>= 0.39.0, < 1.0.0) security - sigh (>= 1.2.1, < 2.0.0) - spaceship (>= 0.18.1, < 1.0.0) + sigh (>= 1.2.2, < 2.0.0) + spaceship (>= 0.24.0, < 1.0.0) memoist (0.14.0) - method_source (0.8.2) + mime-types (3.0) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0221) mini_magick (4.0.4) - minitest (5.8.3) + mini_portile2 (2.0.0) + minitest (5.8.4) multi_json (1.11.2) multi_xml (0.5.5) multipart-post (2.0.0) net-sftp (2.1.2) net-ssh (>= 2.6.5) - net-ssh (3.0.2) - pem (1.1.1) - fastlane_core (>= 0.30.0, < 1.0.0) - spaceship (>= 0.18.1, < 1.0.0) - pilot (1.2.1) + net-ssh (3.1.0) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) + os (0.9.6) + pem (1.3.0) + fastlane_core (>= 0.36.1, < 1.0.0) + spaceship (>= 0.22.0, < 1.0.0) + pilot (1.4.1) credentials_manager (>= 0.3.0) - fastlane_core (>= 0.31.0, < 1.0.0) - spaceship (>= 0.16.0, < 1.0.0) + fastlane_core (>= 0.36.5, < 1.0.0) + spaceship (>= 0.20.0, < 1.0.0) terminal-table (~> 1.4.5) plist (3.1.0) produce (1.1.1) fastlane_core (>= 0.30.0, < 1.0.0) spaceship (>= 0.16.0) - pry (0.10.3) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - retriable (1.4.1) + representable (2.3.0) + uber (~> 0.0.7) + retriable (2.1.0) rouge (1.10.1) rubyzip (1.1.7) - scan (0.3.3) - fastlane_core (>= 0.26.6, < 1.0.0) + scan (0.5.2) + fastlane_core (>= 0.36.1, < 1.0.0) slack-notifier (~> 1.3) terminal-table xcpretty (>= 0.2.1) xcpretty-travis-formatter (>= 0.0.3) + screengrab (0.3.1) + fastlane_core (>= 0.38.0, < 1.0.0) security (0.1.3) - sentry-raven (0.15.2) + sentry-raven (0.15.6) faraday (>= 0.7.6) - sigh (1.2.1) - fastlane_core (>= 0.26.4, < 1.0.0) + sigh (1.6.0) + fastlane_core (>= 0.36.1, < 1.0.0) plist (~> 3.1) - spaceship (>= 0.12.3) + spaceship (>= 0.22.0, < 1.0.0) signet (0.7.2) addressable (~> 2.3) faraday (~> 0.9) jwt (~> 1.5) multi_json (~> 1.10) slack-notifier (1.5.1) - slop (3.6.0) - snapshot (1.4.2) + slather (2.0.1) + clamp (~> 0.6) + nokogiri (~> 1.6.3) + xcodeproj (>= 0.28.2, < 1.1.0) + snapshot (1.12.1) fastimage (~> 1.6.3) - fastlane_core (>= 0.21.0, < 1.0.0) + fastlane_core (>= 0.36.1, < 1.0.0) plist (~> 3.1.0) xcpretty (>= 0.2.1) - spaceship (0.19.0) + spaceship (0.24.0) colored credentials_manager (>= 0.9.0) faraday (~> 0.9) @@ -206,22 +211,20 @@ GEM fastimage (~> 1.6) multi_xml (~> 0.5) plist (~> 3.1) - pry - supply (0.2.2) - credentials_manager (>= 0.10.0) - fastlane_core (>= 0.19.0) - google-api-client (~> 0.8.6) + supply (0.5.2) + credentials_manager (>= 0.15.0) + fastlane_core (>= 0.35.0) + google-api-client (~> 0.9.1) terminal-notifier (1.6.3) terminal-table (1.4.5) + thor (0.19.1) thread_safe (0.3.5) tzinfo (1.2.2) thread_safe (~> 0.1) + uber (0.0.15) unf (0.1.4) unf_ext - unf_ext (0.0.7.1) - xcode-install (1.0.1) - claide (~> 0.9.1) - spaceship (>= 0.13.0, < 1.0.0) + unf_ext (0.0.7.2) xcodeproj (0.28.2) activesupport (>= 3) claide (~> 0.9.1) @@ -237,6 +240,7 @@ PLATFORMS DEPENDENCIES fastlane (>= 1.35) scan + slather xcpretty BUNDLED WITH diff --git a/README.md b/README.md index e61c69b..8573c55 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ ![](https://raw.githubusercontent.com/danthorpe/ValueCoding/development/header.png) [![Build status](https://badge.buildkite.com/482fd5558d9ccf05b669c55f40450166033522f32314a1bbb2.svg)](https://buildkite.com/blindingskies/valuecoding) -[![codecov.io](http://codecov.io/github/danthorpe/ValueCoding/coverage.svg?branch=development)](http://codecov.io/github/danthorpe/ValueCoding?branch=development) -[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/ValueCoding.svg)](https://img.shields.io/cocoapods/v/ValueCoding.svg) +[![Coverage Status](https://coveralls.io/repos/github/danthorpe/ValueCoding/badge.svg?branch=feature%2FVCD-13_coveralls)](https://coveralls.io/github/danthorpe/ValueCoding?branch=development) +[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/ValueCoding.svg)](https://img.shields.io/cocoapods/v/ValueCoding.svg) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platform](https://img.shields.io/cocoapods/p/ValueCoding.svg?style=flat)](http://cocoadocs.org/docsets/ValueCoding) @@ -79,7 +79,7 @@ let foos = Foo.decode(NSKeyedUnarchiver.unarchiveObjectWithData(data) as? [AnyOb The [Money](https://github.com/danthorpe/Money) framework contains more examples of implementing `ValueCoding`. Including the generic type [`FXTransactionCoder`](https://github.com/danthorpe/Money/blob/development/Money/Shared/FX/FX.swift#L467). -The [YapDatabaseExtensions](https://github.com/danthorpe/YapDatabaseExtension) framework relies heavily on `ValueCoding`. For more examples of generic where constraints see its [Functional API](https://github.com/danthorpe/YapDatabaseExtensions/tree/development/YapDatabaseExtensions/Shared/Functional). +The [YapDatabaseExtensions](https://github.com/danthorpe/YapDatabaseExtensions) framework relies heavily on `ValueCoding`. For more examples of generic where constraints see its [Functional API](https://github.com/danthorpe/YapDatabaseExtensions/tree/development/YapDatabaseExtensions/Shared/Functional). ### Installation ValueCoding builds as a cross platform (iOS, OS X, watchOS, tvOS) extension compatible framework. It is also available via CocoaPods diff --git a/Tests/Support.swift b/Tests/Support.swift index 78a95a3..7383c41 100644 --- a/Tests/Support.swift +++ b/Tests/Support.swift @@ -22,8 +22,8 @@ class FooCoder: NSObject, NSCoding, CodingType { let value: Foo - required init(_ v: Foo) { - value = v + required init(_ aValue: Foo) { + value = aValue } required init?(coder aDecoder: NSCoder) { @@ -38,7 +38,6 @@ class FooCoder: NSObject, NSCoding, CodingType { extension Foo: Equatable { } -func ==(a: Foo, b: Foo) -> Bool { - return a.bar == b.bar +func == (lhs: Foo, rhs: Foo) -> Bool { + return lhs.bar == rhs.bar } - diff --git a/Tests/ValueCodingTests.swift b/Tests/ValueCodingTests.swift index 080ad28..c008529 100644 --- a/Tests/ValueCodingTests.swift +++ b/Tests/ValueCodingTests.swift @@ -79,4 +79,3 @@ class ValueCodingTests: XCTestCase { XCTAssertEqual(items.encoded.values, items) } } - diff --git a/ValueCoding.podspec b/ValueCoding.podspec index b11f253..fa6c44d 100644 --- a/ValueCoding.podspec +++ b/ValueCoding.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ValueCoding" - s.version = "1.2.0" + s.version = "1.3.0" s.summary = "Swift protocols for encoding/decoding value types." s.description = <<-DESC @@ -19,7 +19,7 @@ Pod::Spec.new do |s| s.author = { "Daniel Thorpe" => "@danthorpe" } s.source = { :git => "https://github.com/danthorpe/ValueCoding.git", :tag => s.version.to_s } s.module_name = 'ValueCoding' - s.documentation_url = 'http://docs.danthorpe.me/valuecoding/1.2.0/index.html' + s.documentation_url = 'http://docs.danthorpe.me/valuecoding/1.3.0/index.html' s.social_media_url = 'https://twitter.com/danthorpe' s.requires_arc = true s.ios.deployment_target = '8.0' diff --git a/ValueCoding.xcodeproj/project.pbxproj b/ValueCoding.xcodeproj/project.pbxproj index 1a5babb..9e02569 100644 --- a/ValueCoding.xcodeproj/project.pbxproj +++ b/ValueCoding.xcodeproj/project.pbxproj @@ -227,6 +227,7 @@ isa = PBXNativeTarget; buildConfigurationList = 652D3D981BCAA5AE00712107 /* Build configuration list for PBXNativeTarget "ValueCoding-OSX" */; buildPhases = ( + 65A76FB51CA1FF2A00F62CBD /* Swift Lint */, 652D3D7D1BCAA5AD00712107 /* Sources */, 652D3D7E1BCAA5AD00712107 /* Frameworks */, 652D3D7F1BCAA5AD00712107 /* Headers */, @@ -263,6 +264,7 @@ isa = PBXNativeTarget; buildConfigurationList = 652D3DB01BCAA66500712107 /* Build configuration list for PBXNativeTarget "ValueCoding-iOS" */; buildPhases = ( + 65A76FB61CA1FF5900F62CBD /* Swift Lint */, 652D3D9A1BCAA66500712107 /* Sources */, 652D3D9B1BCAA66500712107 /* Frameworks */, 652D3D9C1BCAA66500712107 /* Headers */, @@ -299,6 +301,7 @@ isa = PBXNativeTarget; buildConfigurationList = 652D3DD61BCAB86D00712107 /* Build configuration list for PBXNativeTarget "ValueCoding-watchOS" */; buildPhases = ( + 65A76FB71CA1FF7E00F62CBD /* Swift Lint */, 652D3DCC1BCAB86D00712107 /* Sources */, 652D3DCD1BCAB86D00712107 /* Frameworks */, 652D3DCE1BCAB86D00712107 /* Headers */, @@ -317,6 +320,7 @@ isa = PBXNativeTarget; buildConfigurationList = 65E7662A1BDFA84300889368 /* Build configuration list for PBXNativeTarget "ValueCoding-tvOS" */; buildPhases = ( + 65A76FB81CA1FF9900F62CBD /* Swift Lint */, 65E766101BDFA84200889368 /* Sources */, 65E766111BDFA84200889368 /* Frameworks */, 65E766121BDFA84200889368 /* Headers */, @@ -456,6 +460,69 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 65A76FB51CA1FF2A00F62CBD /* Swift Lint */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Swift Lint"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint autocorrect\n [ -f .swiftlint.yml ] && CONFIG=\".swiftlint.yml\" || CONFIG=\"$HOME/.swiftlint.yml\"\n swiftlint lint --config $CONFIG\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + showEnvVarsInLog = 0; + }; + 65A76FB61CA1FF5900F62CBD /* Swift Lint */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Swift Lint"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint autocorrect\n [ -f .swiftlint.yml ] && CONFIG=\".swiftlint.yml\" || CONFIG=\"$HOME/.swiftlint.yml\"\n swiftlint lint --config $CONFIG\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + showEnvVarsInLog = 0; + }; + 65A76FB71CA1FF7E00F62CBD /* Swift Lint */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Swift Lint"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint autocorrect\n [ -f .swiftlint.yml ] && CONFIG=\".swiftlint.yml\" || CONFIG=\"$HOME/.swiftlint.yml\"\n swiftlint lint --config $CONFIG\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + showEnvVarsInLog = 0; + }; + 65A76FB81CA1FF9900F62CBD /* Swift Lint */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Swift Lint"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint autocorrect\n [ -f .swiftlint.yml ] && CONFIG=\".swiftlint.yml\" || CONFIG=\"$HOME/.swiftlint.yml\"\n swiftlint lint --config $CONFIG\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 652D3D7D1BCAA5AD00712107 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -540,22 +607,24 @@ 652D3D7B1BCAA53A00712107 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_CODE_COVERAGE = YES; ENABLE_TESTABILITY = YES; INFOPLIST_FILE = "$(SRCROOT)/ValueCoding/Supporting Files/Info.plist"; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = "me.danthorpe.$(PRODUCT_NAME)"; PRODUCT_NAME = ValueCoding; - PROJECT_VERSION = 1.2.0; + PROJECT_VERSION = 1.3.0; }; name = Debug; }; 652D3D7C1BCAA53A00712107 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_CODE_COVERAGE = YES; INFOPLIST_FILE = "$(SRCROOT)/ValueCoding/Supporting Files/Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "me.danthorpe.$(PRODUCT_NAME)"; PRODUCT_NAME = ValueCoding; - PROJECT_VERSION = 1.2.0; + PROJECT_VERSION = 1.3.0; }; name = Release; }; diff --git a/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding-tvOS.xcscheme b/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding-tvOS.xcscheme index be9074e..162e0a7 100644 --- a/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding-tvOS.xcscheme +++ b/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding-tvOS.xcscheme @@ -26,7 +26,8 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> diff --git a/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding-watchOS.xcscheme b/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding-watchOS.xcscheme index 9fb5670..bf0c6e7 100644 --- a/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding-watchOS.xcscheme +++ b/ValueCoding.xcodeproj/xcshareddata/xcschemes/ValueCoding-watchOS.xcscheme @@ -26,7 +26,8 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> diff --git a/ValueCoding/ValueCoding.swift b/ValueCoding/ValueCoding.swift index 753d4fa..68b49d7 100644 --- a/ValueCoding/ValueCoding.swift +++ b/ValueCoding/ValueCoding.swift @@ -11,26 +11,26 @@ import Foundation // MARK: - CodingType /** -A generic protocol for classes which can +A generic protocol for classes which can encode/decode value types. */ public protocol CodingType { - /** + /** The type of the composed value, ValueType - + Bear in mind that there are no constraints on this type. However, in reality when working with generic types which require coding, it will be necessary to constrain your generic clauses like this: - + ```swift func foo() ``` - + - see: ValueCoding */ - typealias ValueType + associatedtype ValueType /// The value type which is being encoded/decoded var value: ValueType { get } @@ -49,10 +49,10 @@ public protocol ValueCoding { /** The Coder which implements CodingType - + - see: CodingType */ - typealias Coder: CodingType + associatedtype Coder: CodingType } // MARK: - Protocol Extensions @@ -106,7 +106,7 @@ extension ValueCoding where Coder: NSCoding, Coder.ValueType == Self { For example let foos = Foo.decode(decoder.decodeObjectForKey("foos") as? [AnyObject]) - + - parameter objects: a `SequenceType` of `AnyObject`. - returns: the array of values which were able to be unarchived. */ @@ -126,11 +126,11 @@ extension ValueCoding where Coder: NSCoding, Coder.ValueType == Self { /** Encodes the value type into its Coder. - - Typically this would be used inside of + + Typically this would be used inside of `encodeWithCoder:` when the value is composed inside another `ValueCoding` or `NSCoding` type. For example: - + encoder.encodeObject(foo.encoded, forKey: "foo") */ @@ -149,7 +149,7 @@ extension SequenceType where Typically this would be used inside of `encodeWithCoder:` when a sequence of values is - composed inside another `ValueCoding` or + composed inside another `ValueCoding` or `NSCoding` type. For example: encoder.encodeObject(foos.encoded, forKey: "foos") @@ -167,13 +167,10 @@ extension SequenceType where Generator.Element.Generator.Element.Coder.ValueType == Generator.Element.Generator.Element { /** - Encodes a sequence of sequences of value types into + Encodes a sequence of sequences of value types into an array of arrays of coders. */ public var encoded: [[Generator.Element.Generator.Element.Coder]] { return map { $0.encoded } } } - - -