Skip to content

Commit

Permalink
Merge pull request #145 from ikesyo/swift3
Browse files Browse the repository at this point in the history
Swift 3 support
  • Loading branch information
ikesyo authored Sep 17, 2016
2 parents 706a8aa + b42b35d commit b238ffc
Show file tree
Hide file tree
Showing 30 changed files with 264 additions and 437 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DEVELOPMENT-SNAPSHOT-2016-03-01-a
3.0
30 changes: 10 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,28 @@ env:
- LC_CTYPE=en_US.UTF-8
matrix:
include:
- os: osx
language: objective-c
osx_image: xcode7.3
script:
- pod lib lint --allow-warnings --quick
- rake "build[test, Himotoki-Mac, macosx, arch=x86_64]"
- rake "build[test, Himotoki-iOS, iphonesimulator, name=iPhone 6s]"
- rake "build[test, Himotoki-tvOS, appletvsimulator, name=Apple TV 1080p]"
- rake "build[build, Himotoki-watchOS, watchsimulator, name=Apple Watch - 38mm]"
- os: osx
language: objective-c
osx_image: xcode8
script:
- pod lib lint --allow-warnings --quick
- rake "build[build-for-testing test-without-building, Himotoki-Mac, macosx, arch=x86_64]"
- gem update cocoapods --pre # Install 1.1.0.rc.2
- pod lib lint --allow-warnings
- rake "build[build-for-testing test-without-building, Himotoki-macOS, macosx, arch=x86_64]"
- rake "build[build-for-testing test-without-building, Himotoki-iOS, iphonesimulator, name=iPhone 6s]"
- rake "build[build-for-testing test-without-building, Himotoki-tvOS, appletvsimulator, name=Apple TV 1080p]"
- rake "build[build, Himotoki-watchOS, watchsimulator, name=Apple Watch - 38mm]"
# - os: osx
# language: generic
# osx_image: xcode7.3
# before_install:
# - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)"
# script:
# - swift build
# - swift test
- os: osx
language: generic
osx_image: xcode8
script:
- swift build
- swift test
- os: linux
language: generic
sudo: required
dist: trusty
before_install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)"
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
script:
- swift build
- swift test
Expand Down
1 change: 0 additions & 1 deletion Himotoki.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ DESC
s.source = { :git => "https://github.com/ikesyo/Himotoki.git", :tag => s.version }
s.source_files = "Sources/**/*.swift"
s.requires_arc = true
s.pod_target_xcconfig = { "SWIFT_VERSION" => "2.3" }
end
70 changes: 32 additions & 38 deletions Himotoki.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
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 = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -16,7 +16,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "CDF03E321AF606F60041C3AA"
BuildableName = "Himotoki.framework"
BlueprintName = "Himotoki-Mac"
BlueprintName = "Himotoki-macOS"
ReferencedContainer = "container:Himotoki.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -29,8 +29,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CDF03E3C1AF606F60041C3AA"
BuildableName = "HimotokiTests-Mac.xctest"
BlueprintName = "HimotokiTests-Mac"
BuildableName = "HimotokiTests-macOS.xctest"
BlueprintName = "HimotokiTests-macOS"
ReferencedContainer = "container:Himotoki.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -48,8 +48,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CDF03E3C1AF606F60041C3AA"
BuildableName = "HimotokiTests-Mac.xctest"
BlueprintName = "HimotokiTests-Mac"
BuildableName = "HimotokiTests-macOS.xctest"
BlueprintName = "HimotokiTests-macOS"
ReferencedContainer = "container:Himotoki.xcodeproj">
</BuildableReference>
</TestableReference>
Expand All @@ -59,7 +59,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "CDF03E321AF606F60041C3AA"
BuildableName = "Himotoki.framework"
BlueprintName = "Himotoki-Mac"
BlueprintName = "Himotoki-macOS"
ReferencedContainer = "container:Himotoki.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -81,7 +81,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "CDF03E321AF606F60041C3AA"
BuildableName = "Himotoki.framework"
BlueprintName = "Himotoki-Mac"
BlueprintName = "Himotoki-macOS"
ReferencedContainer = "container:Himotoki.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -99,7 +99,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "CDF03E321AF606F60041C3AA"
BuildableName = "Himotoki.framework"
BlueprintName = "Himotoki-Mac"
BlueprintName = "Himotoki-macOS"
ReferencedContainer = "container:Himotoki.xcodeproj">
</BuildableReference>
</MacroExpansion>
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 = "0710"
LastUpgradeVersion = "0800"
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 = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
24 changes: 5 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,21 @@ let otherURLs = try URLTransformer.apply(e <|| "bar_urls")

## Requirements

- Swift 2.2 / Xcode 7.3
- Swift 3.0 / Xcode 8
- OS X 10.9 or later
- iOS 8.0 or later (by Carthage or CocoaPods) / iOS 7 (by copying the source files directly)
- iOS 8.0 or later
- tvOS 9.0 or later
- watchOS 2.0 or later

## Installation

There are 3 options. If your app support iOS 7, you can only use the last way.
There are 2 options.

### Framework with Carthage (preferable)

Himotoki is [Carthage](https://github.com/Carthage/Carthage) compatible.

- Add `github "ikesyo/Himotoki" ~> 2.1.1` to your Cartfile.
- Add `github "ikesyo/Himotoki" ~> 3.0` to your Cartfile.
- Run `carthage update`.

### Framework with CocoaPods
Expand All @@ -115,25 +115,11 @@ Himotoki also can be used by [CocoaPods](https://cocoapods.org/).

```ruby
use_frameworks!
pod "Himotoki", "~> 2.1.1"
pod "Himotoki", "~> 3.0"
```

- Run `pod install`.

### Copying the source files directly

- Add this repository as a git submodule:

```swift
$ git submodule add https://github.com/ikesyo/Himotoki.git PATH_TO_SUBMODULE
// or
$ carthage update --use-submodules
```

- Then just add references of `Sources/*.swift` to your Xcode project.

## License

Himotoki is released under the [MIT License](LICENSE.md).
87 changes: 0 additions & 87 deletions Sources/Builder.swift

This file was deleted.

4 changes: 2 additions & 2 deletions Sources/Casting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// Copyright © 2016 Syo Ikeda. All rights reserved.
//

internal func castOrFail<T>(e: Extractor) throws -> T {
internal func castOrFail<T>(_ e: Extractor) throws -> T {
return try castOrFail(e.rawValue)
}

public func castOrFail<T>(any: Any) throws -> T {
public func castOrFail<T>(_ any: Any) throws -> T {
guard let result = any as? T else {
throw typeMismatch("\(T.self)", actual: any, keyPath: nil)
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/Decodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@

public protocol Decodable {
/// - Throws: DecodeError or an arbitrary ErrorType
static func decode(e: Extractor) throws -> Self
static func decode(_ e: Extractor) throws -> Self
}

// MARK: - Extensions

extension Decodable {
/// - Throws: DecodeError or an arbitrary ErrorType
public static func decodeValue(JSON: AnyJSON) throws -> Self {
public static func decodeValue(_ JSON: Any) throws -> Self {
let extractor = Extractor(JSON)
return try self.decode(extractor)
}

/// - Throws: DecodeError or an arbitrary ErrorType
public static func decodeValue(JSON: AnyJSON, rootKeyPath: KeyPath) throws -> Self {
public static func decodeValue(_ JSON: Any, rootKeyPath: KeyPath) throws -> Self {
return try Extractor(JSON).value(rootKeyPath)
}
}
Loading

0 comments on commit b238ffc

Please sign in to comment.