Skip to content

Commit

Permalink
Merge pull request #80 from SwiftGen/feature/swift4
Browse files Browse the repository at this point in the history
Migrate to Swift 4
  • Loading branch information
djbe authored Apr 9, 2018
2 parents 1d0a0a9 + 386fd45 commit 0a31be4
Show file tree
Hide file tree
Showing 18 changed files with 107 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defaults:
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
BUNDLE_PATH: vendor/bundle
macos:
xcode: "8.3.3"
xcode: "9.2.0"
shell: /bin/bash --login -eo pipefail
- &prepare-storage
run:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.4.1
ruby-2.4.2
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ _None_
* Migrated to CircleCI 2.0.
[David Jennes](https://github.com/djbe)
[#81](https://github.com/SwiftGen/StencilSwiftKit/pull/81)
* Migrated to Swift 4, and dropped support for Swift 3.
[David Jennes](https://github.com/djbe)
[#80](https://github.com/SwiftGen/StencilSwiftKit/pull/80)

## 2.4.0

Expand Down
27 changes: 23 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
// swift-tools-version:4.0
import PackageDescription

let package = Package(
name: "StencilSwiftKit",
targets: [
Target(name: "StencilSwiftKit", dependencies: [])
products: [
.library(name: "StencilSwiftKit", targets: ["StencilSwiftKit"])
],
dependencies: [
.Package(url: "https://github.com/kylef/Stencil.git", majorVersion: 0, minor: 10),
]
.package(url: "https://github.com/kylef/Stencil.git", .upToNextMinor(from: "0.10.0"))
],
targets: [
.target(
name: "StencilSwiftKit",
dependencies: [
"Stencil"
],
path: "",
sources: ["Sources"]
),
.testTarget(
name: "StencilSwiftKitTests",
dependencies: [
"StencilSwiftKit"
],
path: "Tests"
)
],
swiftLanguageVersions: [4]
)
9 changes: 9 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ target 'Tests' do
pod 'StencilSwiftKit', path: '.'
pod 'SwiftLint', '~> 0.25'
end

post_install do |installer|
swift3_pods = %w(Stencil)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.2' if swift3_pods.include?(target.name)
end
end
end
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
PathKit: dcab05d701474011aae0e40cf892298a831f63d6
Stencil: 40b382c52edab08f1e800e6144c1f04ae47a7a9a
StencilSwiftKit: 385f50e5263290411a059dadcbbc153b4f242f3c
StencilSwiftKit: 67d1f9598afc6785293a21bd5ebe214b02343a2e
SwiftLint: e14651157288e9e01d6e1a71db7014fb5744a8ea

PODFILE CHECKSUM: 4f35313d732240f2655b591ec8ce3f742e804e98
PODFILE CHECKSUM: 04a106459aafed0d043229000123a22c447e0e7e

COCOAPODS: 1.4.0
2 changes: 2 additions & 0 deletions Pods/Local Podspecs/StencilSwiftKit.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 47 additions & 47 deletions Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![CircleCI](https://circleci.com/gh/SwiftGen/StencilSwiftKit/tree/master.svg?style=svg)](https://circleci.com/gh/SwiftGen/StencilSwiftKit/tree/master)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/StencilSwiftKit.svg)](https://img.shields.io/cocoapods/v/StencilSwiftKit.svg)
[![Platform](https://img.shields.io/cocoapods/p/StencilSwiftKit.svg?style=flat)](http://cocoadocs.org/docsets/StencilSwiftKit)
![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg)
![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg)

`StencilSwiftKit` is a framework bringing additional [Stencil](https://github.com/kylef/Stencil) nodes & filters dedicated to Swift code generation.

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WORKSPACE = 'StencilSwiftKit'.freeze
SCHEME_NAME = 'Tests'.freeze
CONFIGURATION = 'Debug'.freeze
POD_NAME = 'StencilSwiftKit'.freeze
MIN_XCODE_VERSION = 8.3
MIN_XCODE_VERSION = 9.2

## [ Release a new version ] ##################################################

Expand Down
6 changes: 4 additions & 2 deletions Sources/CallMacroNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ class CallNode: NodeType {
throw TemplateSyntaxError("Call to undefined block '\(variableName)'.")
}
guard block.parameters.count == arguments.count else {
throw TemplateSyntaxError("Block '\(variableName)' accepts \(block.parameters.count) parameters, " +
"\(arguments.count) given.")
throw TemplateSyntaxError("""
Block '\(variableName)' accepts \(block.parameters.count) parameters, \
\(arguments.count) given.
""")
}
let blockContext = try block.context(context, arguments: arguments)

Expand Down
4 changes: 2 additions & 2 deletions Sources/Filters+Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ extension Filters.Strings {
/// e.g. "People picker" gives "people picker", "Sports Stats" gives "sports Stats"
static func lowerFirstLetter(_ value: Any?) throws -> Any? {
let string = try Filters.parseString(from: value)
let first = String(string.characters.prefix(1)).lowercased()
let other = String(string.characters.dropFirst(1))
let first = String(string.prefix(1)).lowercased()
let other = String(string.dropFirst(1))
return first + other
}

Expand Down
7 changes: 4 additions & 3 deletions Sources/MapNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ class MapNode: NodeType {

guard components.count == 4 && components[2] == "into" ||
components.count == 6 && components[2] == "into" && components[4] == "using" else {
let error = "'map' statements should use the following " +
"'map {array} into {varname} [using {element}]' `\(token.contents)`."
throw TemplateSyntaxError(error)
throw TemplateSyntaxError("""
'map' statements should use the following 'map {array} into \
{varname} [using {element}]' `\(token.contents)`.
""")
}

let variable = components[1]
Expand Down
3 changes: 2 additions & 1 deletion StencilSwiftKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ Pod::Spec.new do |s|
s.social_media_url = 'https://twitter.com/aligatr'

s.platform = :osx, '10.9'
s.swift_version = '4.0'
s.cocoapods_version = '>= 1.4.0'

s.source = { git: 'https://github.com/SwiftGen/StencilSwiftKit.git', tag: s.version.to_s }

s.source_files = 'Sources/**/*.swift'

s.dependency 'Stencil', '~> 0.10'
Expand Down
Loading

0 comments on commit 0a31be4

Please sign in to comment.