Fully upgrading to Swift 4.1.1
`flatMap()` -> `compactMap()`
This commit is contained in:
parent
94123e4974
commit
0349fd1d62
|
@ -67,3 +67,6 @@ fastlane/test_output
|
||||||
Packages/
|
Packages/
|
||||||
*.xcodeproj/
|
*.xcodeproj/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
*.resolved
|
||||||
|
*.pins
|
|
@ -1,3 +1,4 @@
|
||||||
|
// swift-tools-version:4.0
|
||||||
//
|
//
|
||||||
// Package.swift
|
// Package.swift
|
||||||
// PerfectMustache
|
// PerfectMustache
|
||||||
|
@ -9,7 +10,7 @@
|
||||||
//
|
//
|
||||||
// This source file is part of the Perfect.org open source project
|
// This source file is part of the Perfect.org open source project
|
||||||
//
|
//
|
||||||
// Copyright (c) 2015 - 2016 PerfectlySoft Inc. and the Perfect project authors
|
// Copyright (c) 2015 - 2018 PerfectlySoft Inc. and the Perfect project authors
|
||||||
// Licensed under Apache License v2.0
|
// Licensed under Apache License v2.0
|
||||||
//
|
//
|
||||||
// See http://perfect.org/licensing.html for license information
|
// See http://perfect.org/licensing.html for license information
|
||||||
|
@ -18,10 +19,16 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
let package = Package(name: "PerfectMustache",
|
||||||
let package = Package(
|
products: [.library(name: "PerfectMustache",targets: ["PerfectMustache"]),],
|
||||||
name: "PerfectMustache",
|
dependencies: [
|
||||||
targets: [],
|
.package(url: "https://github.com/PerfectlySoft/Perfect-HTTP.git", .branch("master")),
|
||||||
dependencies: [.Package(url: "https://github.com/PerfectlySoft/Perfect-HTTP.git", majorVersion: 3)],
|
],
|
||||||
exclude: []
|
targets: [
|
||||||
)
|
.target(
|
||||||
|
name: "PerfectMustache",
|
||||||
|
dependencies: ["PerfectHTTP"]),
|
||||||
|
.testTarget(
|
||||||
|
name: "PerfectMustacheTests",
|
||||||
|
dependencies: ["PerfectMustache"]),
|
||||||
|
])
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://developer.apple.com/swift/" target="_blank">
|
<a href="https://developer.apple.com/swift/" target="_blank">
|
||||||
<img src="https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat" alt="Swift 4.0">
|
<img src="https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat" alt="Swift 4.1">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://developer.apple.com/swift/" target="_blank">
|
<a href="https://developer.apple.com/swift/" target="_blank">
|
||||||
<img src="https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat" alt="Platforms OS X | Linux">
|
<img src="https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat" alt="Platforms OS X | Linux">
|
||||||
|
@ -48,7 +48,7 @@ This package is designed to work along with [Perfect](https://github.com/Perfect
|
||||||
To start, add this project as a dependency in your Package.swift file.
|
To start, add this project as a dependency in your Package.swift file.
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
.Package(url: "https://github.com/PerfectlySoft/Perfect-Mustache.git", majorVersion: 3)
|
.package(url: "https://github.com/PerfectlySoft/Perfect-Mustache.git", .branch("master"))
|
||||||
```
|
```
|
||||||
|
|
||||||
Basic usage:
|
Basic usage:
|
||||||
|
|
|
@ -610,7 +610,11 @@ public class MustacheTemplate : MustacheGroupTag {
|
||||||
override func populateClone(_ tag: MustacheTag) {
|
override func populateClone(_ tag: MustacheTag) {
|
||||||
super.populateClone(tag)
|
super.populateClone(tag)
|
||||||
if let template = tag as? MustacheTemplate {
|
if let template = tag as? MustacheTemplate {
|
||||||
template.pragmas = self.pragmas.flatMap { $0.clone() as? MustachePragmaTag }
|
#if swift(>=4.1)
|
||||||
|
template.pragmas = self.pragmas.compactMap { $0.clone() as? MustachePragmaTag }
|
||||||
|
#else
|
||||||
|
template.pragmas = self.pragmas.flatMap { $0.clone() as? MustachePragmaTag }
|
||||||
|
#endif
|
||||||
self.templateName = template.templateName
|
self.templateName = template.templateName
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue